Generate daily average hashrate data

This commit is contained in:
nymkappa
2022-02-19 20:45:02 +09:00
parent 38b37a3ee7
commit 6fe8f6fa1e
7 changed files with 156 additions and 8 deletions

View File

@@ -26,6 +26,7 @@ import poolsParser from './api/pools-parser';
import syncAssets from './sync-assets';
import icons from './api/liquid/icons';
import { Common } from './api/common';
import mining from './api/mining';
class Server {
private wss: WebSocket.Server | undefined;
@@ -138,7 +139,7 @@ class Server {
}
await blocks.$updateBlocks();
await memPool.$updateMempool();
blocks.$generateBlockDatabase();
this.runIndexingWhenReady();
setTimeout(this.runMainUpdateLoop.bind(this), config.MEMPOOL.POLL_RATE_MS);
this.currentBackendRetryInterval = 5;
@@ -157,6 +158,14 @@ class Server {
}
}
async runIndexingWhenReady() {
if (!Common.indexingEnabled() || mempool.hasPriority()) {
return;
}
await blocks.$generateBlockDatabase();
await mining.$generateNetworkHashrateHistory();
}
setUpWebsocketHandling() {
if (this.wss) {
websocketHandler.setWebsocketServer(this.wss);