Fix audit sync progress logging

This commit is contained in:
Mononaut committed 2023-07-14 16:43:07 +09:00
1 parent 736b997104
commit 7f6d17fc0e
1 file changed
+3 -2
+3 -2
View File
@@ -37,10 +37,11 @@ class AuditReplication {
let loggerTimer = Date.now();
// process missing audits in batches of
for (let i = 0; i < missingAudits.length; i += BATCH_SIZE) {
const results = await Promise.all(missingAudits.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE).map(hash => this.$syncAudit(hash)));
const slice = missingAudits.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE);
const results = await Promise.all(slice.map(hash => this.$syncAudit(hash)));
const synced = results.reduce((total, status) => status ? total + 1 : total, 0);
totalSynced += synced;
totalMissed += (BATCH_SIZE - synced);
totalMissed += (slice.length - synced);
if (Date.now() - loggerTimer > 10000) {
loggerTimer = Date.now();
logger.info(`Found ${totalSynced} / ${totalSynced + totalMissed} of ${missingAudits.length} missing audits`, 'Replication');