Browse Source

Send idle status of workers once to ckdb with userstats and then stop sending their stats

master
ckolivas 11 years ago
parent
commit
0fadee1520
  1. 11
      src/stratifier.c

11
src/stratifier.c

@ -228,6 +228,7 @@ struct stratum_instance {
bool authorised; bool authorised;
bool idle; bool idle;
bool notified_idle;
user_instance_t *user_instance; user_instance_t *user_instance;
char *useragent; char *useragent;
@ -2124,9 +2125,9 @@ static void update_userstats(ckpool_t *ckp)
uint8_t cycle_mask; uint8_t cycle_mask;
int elapsed; int elapsed;
/* Only show stats from clients that have returned shares in /* Send one lot of stats once the client is idle if they have submitted
* the last 10 minutes */ * no shares in the last 10 minutes with the idle bool set. */
if (client->idle) if (client->idle && client->notified_idle)
continue; continue;
/* Select clients using a mask to return each user's stats once /* Select clients using a mask to return each user's stats once
* every ~10 minutes */ * every ~10 minutes */
@ -2144,7 +2145,7 @@ static void update_userstats(ckpool_t *ckp)
ghs5 = client->dsps5 * nonces; ghs5 = client->dsps5 * nonces;
ghs60 = client->dsps60 * nonces; ghs60 = client->dsps60 * nonces;
ghs1440 = client->dsps1440 * nonces; ghs1440 = client->dsps1440 * nonces;
val = json_pack("{ss,si,si,ss,ss,sf,sf,sf,sf,ss,ss,ss,ss}", val = json_pack("{ss,si,si,ss,ss,sf,sf,sf,sf,sb,ss,ss,ss,ss}",
"poolinstance", ckp->name, "poolinstance", ckp->name,
"instanceid", client->id, "instanceid", client->id,
"elapsed", elapsed, "elapsed", elapsed,
@ -2154,10 +2155,12 @@ static void update_userstats(ckpool_t *ckp)
"hashrate5m", ghs5, "hashrate5m", ghs5,
"hashrate1hr", ghs60, "hashrate1hr", ghs60,
"hashrate24hr", ghs1440, "hashrate24hr", ghs1440,
"idle", client->idle,
"createdate", cdfield, "createdate", cdfield,
"createby", "code", "createby", "code",
"createcode", __func__, "createcode", __func__,
"createinet", "127.0.0.1"); "createinet", "127.0.0.1");
client->notified_idle = client->idle;
} }
/* Mark the last userstats sent on this pass of stats with an end of /* Mark the last userstats sent on this pass of stats with an end of
* stats marker. */ * stats marker. */

Loading…
Cancel
Save