Browse Source

Delay responses to miners on startup to avoid failed subscribes on handover and console message spam, but give warnings for extended delays.

master
Con Kolivas 10 years ago
parent
commit
a017aef5f3
  1. 9
      src/stratifier.c

9
src/stratifier.c

@ -5442,6 +5442,7 @@ static void parse_instance_msg(ckpool_t *ckp, sdata_t *sdata, smsg_t *msg, strat
{
json_t *val = msg->json_msg, *id_val, *method, *params;
int64_t client_id = msg->client_id;
int delays = 0;
if (client->reject == 2) {
LOGINFO("Dropping client %"PRId64" %s tagged for lazy invalidation",
@ -5480,6 +5481,14 @@ static void parse_instance_msg(ckpool_t *ckp, sdata_t *sdata, smsg_t *msg, strat
send_json_err(sdata, client_id, id_val, "-1:params not found");
goto out;
}
/* At startup we block until there's a current workbase otherwise we
* will reject miners with the initialising message. A slightly delayed
* response to subscribe is better tolerated. */
while (unlikely(!sdata->current_workbase)) {
cksleep_ms(100);
if (!(++delays % 50))
LOGWARNING("%d Second delay waiting for bitcoind at startup", delays / 10);
}
parse_method(ckp, sdata, client, client_id, id_val, method, params);
out:
free_smsg(msg);

Loading…
Cancel
Save