Browse Source

Fix apparent dropping of hashrate on restart due to zero last share time

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

5
src/stratifier.c

@ -1662,6 +1662,7 @@ static void read_userstats(ckpool_t *ckp, user_instance_t *instance)
return; return;
} }
tv_time(&instance->last_share);
instance->dsps1 = dsps_from_key(val, "hashrate1m"); instance->dsps1 = dsps_from_key(val, "hashrate1m");
instance->dsps5 = dsps_from_key(val, "hashrate5m"); instance->dsps5 = dsps_from_key(val, "hashrate5m");
instance->dsps60 = dsps_from_key(val, "hashrate1hr"); instance->dsps60 = dsps_from_key(val, "hashrate1hr");
@ -1683,7 +1684,7 @@ static void read_workerstats(ckpool_t *ckp, worker_instance_t *worker)
snprintf(s, 511, "%s/workers/%s", ckp->logdir, worker->workername); snprintf(s, 511, "%s/workers/%s", ckp->logdir, worker->workername);
fp = fopen(s, "re"); fp = fopen(s, "re");
if (!fp) { if (!fp) {
LOGINFO("Worker %s does not have a logfile to read"); LOGINFO("Worker %s does not have a logfile to read", worker->workername);
return; return;
} }
memset(s, 0, 512); memset(s, 0, 512);
@ -1698,6 +1699,8 @@ static void read_workerstats(ckpool_t *ckp, worker_instance_t *worker)
LOGINFO("Failed to json decode worker %s logfile: %s", worker->workername, s); LOGINFO("Failed to json decode worker %s logfile: %s", worker->workername, s);
return; return;
} }
tv_time(&worker->last_share);
worker->dsps1 = dsps_from_key(val, "hashrate1m"); worker->dsps1 = dsps_from_key(val, "hashrate1m");
worker->dsps5 = dsps_from_key(val, "hashrate5m"); worker->dsps5 = dsps_from_key(val, "hashrate5m");
worker->dsps60 = dsps_from_key(val, "hashrate1d"); worker->dsps60 = dsps_from_key(val, "hashrate1d");

Loading…
Cancel
Save