Fix audit sync progress logging
This commit is contained in:
		
							parent
							
								
									736b997104
								
							
						
					
					
						commit
						7f6d17fc0e
					
				@ -37,10 +37,11 @@ class AuditReplication {
 | 
				
			|||||||
    let loggerTimer = Date.now();
 | 
					    let loggerTimer = Date.now();
 | 
				
			||||||
    // process missing audits in batches of 
 | 
					    // process missing audits in batches of 
 | 
				
			||||||
    for (let i = 0; i < missingAudits.length; i += BATCH_SIZE) {
 | 
					    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);
 | 
					      const synced = results.reduce((total, status) => status ? total + 1 : total, 0);
 | 
				
			||||||
      totalSynced += synced;
 | 
					      totalSynced += synced;
 | 
				
			||||||
      totalMissed += (BATCH_SIZE - synced);
 | 
					      totalMissed += (slice.length - synced);
 | 
				
			||||||
      if (Date.now() - loggerTimer > 10000) {
 | 
					      if (Date.now() - loggerTimer > 10000) {
 | 
				
			||||||
        loggerTimer = Date.now();
 | 
					        loggerTimer = Date.now();
 | 
				
			||||||
        logger.info(`Found ${totalSynced} / ${totalSynced + totalMissed} of ${missingAudits.length} missing audits`, 'Replication');
 | 
					        logger.info(`Found ${totalSynced} / ${totalSynced + totalMissed} of ${missingAudits.length} missing audits`, 'Replication');
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user