From 537e50c682b464ae69a451ff64c4e67fdbe25085 Mon Sep 17 00:00:00 2001 From: nymkappa Date: Mon, 21 Feb 2022 16:54:43 +0900 Subject: [PATCH] Reduce log spam during hashrate indexing --- backend/src/api/mining.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/api/mining.ts b/backend/src/api/mining.ts index db73117ce..2411420cb 100644 --- a/backend/src/api/mining.ts +++ b/backend/src/api/mining.ts @@ -111,13 +111,13 @@ class Mining { return; } - logger.info(`Indexing hashrates`); - if (this.hashrateIndexingStarted) { return; } this.hashrateIndexingStarted = true; + logger.info(`Indexing hashrates`); + const totalDayIndexed = (await BlocksRepository.$blockCount(null, null)) / 144; const indexedTimestamp = (await HashratesRepository.$get(null)).map(hashrate => hashrate.timestamp); let startedAt = new Date().getTime() / 1000; @@ -149,7 +149,7 @@ class Mining { blockStats.lastBlockHeight); const elapsedSeconds = Math.max(1, Math.round((new Date().getTime() / 1000) - startedAt)); - if (elapsedSeconds > 1) { + if (elapsedSeconds > 10) { const daysPerSeconds = Math.max(1, Math.round(indexedThisRun / elapsedSeconds)); const formattedDate = new Date(fromTimestamp * 1000).toUTCString(); const daysLeft = Math.round(totalDayIndexed - totalIndexed);