fix cpfp indexing rate calculation
This commit is contained in:
		
							parent
							
								
									ee95d033ac
								
							
						
					
					
						commit
						7793eaecbc
					
				@ -341,6 +341,7 @@ class Blocks {
 | 
				
			|||||||
    try {
 | 
					    try {
 | 
				
			||||||
      // Get all indexed block hash
 | 
					      // Get all indexed block hash
 | 
				
			||||||
      const unindexedBlocks = await blocksRepository.$getCPFPUnindexedBlocks();
 | 
					      const unindexedBlocks = await blocksRepository.$getCPFPUnindexedBlocks();
 | 
				
			||||||
 | 
					      logger.info(`Indexing cpfp data for ${unindexedBlocks.length} blocks`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (!unindexedBlocks?.length) {
 | 
					      if (!unindexedBlocks?.length) {
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
@ -357,7 +358,7 @@ class Blocks {
 | 
				
			|||||||
        const elapsedSeconds = Math.max(1, new Date().getTime() / 1000 - timer);
 | 
					        const elapsedSeconds = Math.max(1, new Date().getTime() / 1000 - timer);
 | 
				
			||||||
        if (elapsedSeconds > 5) {
 | 
					        if (elapsedSeconds > 5) {
 | 
				
			||||||
          const runningFor = Math.max(1, Math.round((new Date().getTime() / 1000) - startedAt));
 | 
					          const runningFor = Math.max(1, Math.round((new Date().getTime() / 1000) - startedAt));
 | 
				
			||||||
          const blockPerSeconds = Math.max(1, countThisRun / elapsedSeconds);
 | 
					          const blockPerSeconds = (countThisRun / elapsedSeconds);
 | 
				
			||||||
          const progress = Math.round(count / unindexedBlocks.length * 10000) / 100;
 | 
					          const progress = Math.round(count / unindexedBlocks.length * 10000) / 100;
 | 
				
			||||||
          logger.debug(`Indexing cpfp clusters for #${block.height} | ~${blockPerSeconds.toFixed(2)} blocks/sec | total: ${count}/${unindexedBlocks.length} (${progress}%) | elapsed: ${runningFor} seconds`);
 | 
					          logger.debug(`Indexing cpfp clusters for #${block.height} | ~${blockPerSeconds.toFixed(2)} blocks/sec | total: ${count}/${unindexedBlocks.length} (${progress}%) | elapsed: ${runningFor} seconds`);
 | 
				
			||||||
          timer = new Date().getTime() / 1000;
 | 
					          timer = new Date().getTime() / 1000;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user