mirror of
https://git.wownero.com/wownero/wownero-puddle.git
synced 2024-08-15 01:03:20 +00:00
show time of last fetched template in the web ui
This commit is contained in:
parent
0de8aaffcd
commit
2d0e62929a
4 changed files with 26 additions and 9 deletions
|
@ -1342,7 +1342,7 @@ rpc_on_block_template(const char* data, rpc_callback_t *callback)
|
||||||
json_object_put(root);
|
json_object_put(root);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
pool_stats.last_template_fetched = time(NULL);
|
||||||
block_template_t *front = (block_template_t*) bstack_push(bst, NULL);
|
block_template_t *front = (block_template_t*) bstack_push(bst, NULL);
|
||||||
response_to_block_template(result, front);
|
response_to_block_template(result, front);
|
||||||
pool_clients_send_job();
|
pool_clients_send_job();
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
<tr><td>Network height: </td><td id="network_height"></td></tr>
|
<tr><td>Network height: </td><td id="network_height"></td></tr>
|
||||||
<tr><td>Blocks found: </td><td id="pool_blocks_found"></td></tr>
|
<tr><td>Blocks found: </td><td id="pool_blocks_found"></td></tr>
|
||||||
<tr><td>Last block found: </td><td id="last_block_found"></td></tr>
|
<tr><td>Last block found: </td><td id="last_block_found"></td></tr>
|
||||||
|
<tr><td>Last template: </td><td id="last_template_fetched"></td></tr>
|
||||||
<tr><td>Payment threshold: </td><td id="payment_threshold"></td></tr>
|
<tr><td>Payment threshold: </td><td id="payment_threshold"></td></tr>
|
||||||
<tr><td>Pool fee: </td><td id="pool_fee"></td></tr>
|
<tr><td>Pool fee: </td><td id="pool_fee"></td></tr>
|
||||||
<tr><td>Pool port: </td><td id="pool_port"></td></tr>
|
<tr><td>Pool port: </td><td id="pool_port"></td></tr>
|
||||||
|
@ -53,20 +54,33 @@
|
||||||
</table>
|
</table>
|
||||||
<small><a href="https://github.com/jtgrassie/monero-pool">https://github.com/jtgrassie/monero-pool</a></small>
|
<small><a href="https://github.com/jtgrassie/monero-pool">https://github.com/jtgrassie/monero-pool</a></small>
|
||||||
<script>
|
<script>
|
||||||
function format_last_block(last)
|
function format_last_time(last)
|
||||||
{
|
{
|
||||||
var now = new Date().getTime() / 1000;
|
var now = new Date().getTime() / 1000;
|
||||||
var diff = now - last;
|
var diff = now - last;
|
||||||
|
var v;
|
||||||
if (last == 0)
|
if (last == 0)
|
||||||
return "None yet";
|
return "None yet";
|
||||||
else if (diff < 60)
|
else if (diff < 60)
|
||||||
return parseInt(diff) + " seconds ago";
|
{
|
||||||
|
v = parseInt(diff);
|
||||||
|
return v + " second" + (v != 1 ? "s" : "") + " ago";
|
||||||
|
}
|
||||||
else if (diff < 3600)
|
else if (diff < 3600)
|
||||||
return parseInt(diff/60) + " minutes ago";
|
{
|
||||||
|
v = parseInt(diff/60);
|
||||||
|
return v + " minute" + (v != 1 ? "s" : "") + " ago";
|
||||||
|
}
|
||||||
else if (diff < 86400)
|
else if (diff < 86400)
|
||||||
return parseInt(diff/3600) + " hours ago";
|
{
|
||||||
|
v = parseInt(diff/3600);
|
||||||
|
return v + " hour" + (v != 1 ? "s" : "") + " ago";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return parseInt(diff/86400) + " days ago";
|
{
|
||||||
|
v = parseInt(diff/86400);
|
||||||
|
return v + " day" + (v != 1 ? "s" : "") + " ago";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function format_hashrate(hr)
|
function format_hashrate(hr)
|
||||||
|
@ -93,8 +107,8 @@
|
||||||
var el = document.querySelector("#"+e);
|
var el = document.querySelector("#"+e);
|
||||||
if (!el)
|
if (!el)
|
||||||
continue;
|
continue;
|
||||||
if (e == "last_block_found")
|
if (e == "last_block_found" || e == "last_template_fetched")
|
||||||
el.innerHTML = format_last_block(stats[e]);
|
el.innerHTML = format_last_time(stats[e]);
|
||||||
else if (/hashrate/.test(e))
|
else if (/hashrate/.test(e))
|
||||||
el.innerHTML = format_hashrate(stats[e]);
|
el.innerHTML = format_hashrate(stats[e]);
|
||||||
else
|
else
|
||||||
|
|
|
@ -73,6 +73,7 @@ send_json_stats (void *cls, struct MHD_Connection *connection)
|
||||||
uint64_t ph = context->pool_stats->pool_hashrate;
|
uint64_t ph = context->pool_stats->pool_hashrate;
|
||||||
uint64_t nh = context->pool_stats->network_hashrate;
|
uint64_t nh = context->pool_stats->network_hashrate;
|
||||||
uint64_t height = context->pool_stats->network_height;
|
uint64_t height = context->pool_stats->network_height;
|
||||||
|
uint64_t ltf = context->pool_stats->last_template_fetched;
|
||||||
uint64_t lbf = context->pool_stats->last_block_found;
|
uint64_t lbf = context->pool_stats->last_block_found;
|
||||||
uint32_t pbf = context->pool_stats->pool_blocks_found;
|
uint32_t pbf = context->pool_stats->pool_blocks_found;
|
||||||
uint64_t mh = 0;
|
uint64_t mh = 0;
|
||||||
|
@ -89,6 +90,7 @@ send_json_stats (void *cls, struct MHD_Connection *connection)
|
||||||
"\"pool_hashrate\":%"PRIu64","
|
"\"pool_hashrate\":%"PRIu64","
|
||||||
"\"network_hashrate\":%"PRIu64","
|
"\"network_hashrate\":%"PRIu64","
|
||||||
"\"network_height\":%"PRIu64","
|
"\"network_height\":%"PRIu64","
|
||||||
|
"\"last_template_fetched\":%"PRIu64","
|
||||||
"\"last_block_found\":%"PRIu64","
|
"\"last_block_found\":%"PRIu64","
|
||||||
"\"pool_blocks_found\":%d,"
|
"\"pool_blocks_found\":%d,"
|
||||||
"\"payment_threshold\":%.2f,"
|
"\"payment_threshold\":%.2f,"
|
||||||
|
@ -97,7 +99,7 @@ send_json_stats (void *cls, struct MHD_Connection *connection)
|
||||||
"\"connected_miners\":%d,"
|
"\"connected_miners\":%d,"
|
||||||
"\"miner_hashrate\":%"PRIu64","
|
"\"miner_hashrate\":%"PRIu64","
|
||||||
"\"miner_balance\":%.8f"
|
"\"miner_balance\":%.8f"
|
||||||
"}", ph, nh, height, lbf, pbf,
|
"}", ph, nh, height, ltf, lbf, pbf,
|
||||||
context->payment_threshold, context->pool_fee,
|
context->payment_threshold, context->pool_fee,
|
||||||
context->pool_port, context->pool_stats->connected_miners,
|
context->pool_port, context->pool_stats->connected_miners,
|
||||||
mh, mb);
|
mh, mb);
|
||||||
|
|
|
@ -44,6 +44,7 @@ typedef struct pool_stats_t
|
||||||
uint64_t pool_hashrate;
|
uint64_t pool_hashrate;
|
||||||
uint32_t pool_blocks_found;
|
uint32_t pool_blocks_found;
|
||||||
time_t last_block_found;
|
time_t last_block_found;
|
||||||
|
time_t last_template_fetched;
|
||||||
} pool_stats_t;
|
} pool_stats_t;
|
||||||
|
|
||||||
typedef struct wui_context_t
|
typedef struct wui_context_t
|
||||||
|
|
Loading…
Reference in a new issue