[Indexer] Set log level accordingly - Remove indexing ETAs
This commit is contained in:
		
							parent
							
								
									38fa8de01f
								
							
						
					
					
						commit
						38ac38849e
					
				@ -280,8 +280,7 @@ class Blocks {
 | 
			
		||||
          const runningFor = Math.max(1, Math.round((new Date().getTime() / 1000) - startedAt));
 | 
			
		||||
          const blockPerSeconds = Math.max(1, indexedThisRun / elapsedSeconds);
 | 
			
		||||
          const progress = Math.round(totalIndexed / indexedBlocks.length * 10000) / 100;
 | 
			
		||||
          const timeLeft = Math.round((indexedBlocks.length - totalIndexed) / blockPerSeconds);
 | 
			
		||||
          logger.debug(`Indexing block summary for #${block.height} | ~${blockPerSeconds.toFixed(2)} blocks/sec | total: ${totalIndexed}/${indexedBlocks.length} (${progress}%) | elapsed: ${runningFor} seconds | left: ~${timeLeft} seconds`);
 | 
			
		||||
          logger.debug(`Indexing block summary for #${block.height} | ~${blockPerSeconds.toFixed(2)} blocks/sec | total: ${totalIndexed}/${indexedBlocks.length} (${progress}%) | elapsed: ${runningFor} seconds`);
 | 
			
		||||
          timer = new Date().getTime() / 1000;
 | 
			
		||||
          indexedThisRun = 0;
 | 
			
		||||
        }
 | 
			
		||||
@ -293,7 +292,11 @@ class Blocks {
 | 
			
		||||
        totalIndexed++;
 | 
			
		||||
        newlyIndexed++;
 | 
			
		||||
      }
 | 
			
		||||
      logger.notice(`Blocks summaries indexing completed: indexed ${newlyIndexed} blocks`);
 | 
			
		||||
      if (newlyIndexed > 0) {
 | 
			
		||||
        logger.notice(`Blocks summaries indexing completed: indexed ${newlyIndexed} blocks`);
 | 
			
		||||
      } else {
 | 
			
		||||
        logger.debug(`Blocks summaries indexing completed: indexed ${newlyIndexed} blocks`);
 | 
			
		||||
      }
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      logger.err(`Blocks summaries indexing failed. Trying again in 10 seconds. Reason: ${(e instanceof Error ? e.message : e)}`);
 | 
			
		||||
      throw e;
 | 
			
		||||
@ -348,8 +351,7 @@ class Blocks {
 | 
			
		||||
            const runningFor = Math.max(1, Math.round((new Date().getTime() / 1000) - startedAt));
 | 
			
		||||
            const blockPerSeconds = Math.max(1, indexedThisRun / elapsedSeconds);
 | 
			
		||||
            const progress = Math.round(totalIndexed / indexingBlockAmount * 10000) / 100;
 | 
			
		||||
            const timeLeft = Math.round((indexingBlockAmount - totalIndexed) / blockPerSeconds);
 | 
			
		||||
            logger.debug(`Indexing block #${blockHeight} | ~${blockPerSeconds.toFixed(2)} blocks/sec | total: ${totalIndexed}/${indexingBlockAmount} (${progress}%) | elapsed: ${runningFor} seconds | left: ~${timeLeft} seconds`);
 | 
			
		||||
            logger.debug(`Indexing block #${blockHeight} | ~${blockPerSeconds.toFixed(2)} blocks/sec | total: ${totalIndexed}/${indexingBlockAmount} (${progress}%) | elapsed: ${runningFor} seconds`);
 | 
			
		||||
            timer = new Date().getTime() / 1000;
 | 
			
		||||
            indexedThisRun = 0;
 | 
			
		||||
            loadingIndicators.setProgress('block-indexing', progress, false);
 | 
			
		||||
@ -365,7 +367,11 @@ class Blocks {
 | 
			
		||||
 | 
			
		||||
        currentBlockHeight -= chunkSize;
 | 
			
		||||
      }
 | 
			
		||||
      logger.notice(`Block indexing completed: indexed ${newlyIndexed} blocks`);
 | 
			
		||||
      if (newlyIndexed > 0) {
 | 
			
		||||
        logger.notice(`Block indexing completed: indexed ${newlyIndexed} blocks`);
 | 
			
		||||
      } else {
 | 
			
		||||
        logger.debug(`Block indexing completed: indexed ${newlyIndexed} blocks`);
 | 
			
		||||
      }
 | 
			
		||||
      loadingIndicators.setProgress('block-indexing', 100);
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      logger.err('Block indexing failed. Trying again in 10 seconds. Reason: ' + (e instanceof Error ? e.message : e));
 | 
			
		||||
 | 
			
		||||
@ -250,9 +250,8 @@ class Mining {
 | 
			
		||||
          const runningFor = Math.max(1, Math.round((new Date().getTime() / 1000) - startedAt));
 | 
			
		||||
          const weeksPerSeconds = Math.max(1, Math.round(indexedThisRun / elapsedSeconds));
 | 
			
		||||
          const progress = Math.round(totalIndexed / totalWeekIndexed * 10000) / 100;
 | 
			
		||||
          const timeLeft = Math.round((totalWeekIndexed - totalIndexed) / weeksPerSeconds);
 | 
			
		||||
          const formattedDate = new Date(fromTimestamp).toUTCString();
 | 
			
		||||
          logger.debug(`Getting weekly pool hashrate for ${formattedDate} | ~${weeksPerSeconds.toFixed(2)} weeks/sec | total: ~${totalIndexed}/${Math.round(totalWeekIndexed)} (${progress}%) | elapsed: ${runningFor} seconds | left: ~${timeLeft} seconds`);
 | 
			
		||||
          logger.debug(`Getting weekly pool hashrate for ${formattedDate} | ~${weeksPerSeconds.toFixed(2)} weeks/sec | total: ~${totalIndexed}/${Math.round(totalWeekIndexed)} (${progress}%) | elapsed: ${runningFor} seconds`);
 | 
			
		||||
          timer = new Date().getTime() / 1000;
 | 
			
		||||
          indexedThisRun = 0;
 | 
			
		||||
          loadingIndicators.setProgress('weekly-hashrate-indexing', progress, false);
 | 
			
		||||
@ -265,6 +264,8 @@ class Mining {
 | 
			
		||||
      await HashratesRepository.$setLatestRun('last_weekly_hashrates_indexing', new Date().getUTCDate());
 | 
			
		||||
      if (newlyIndexed > 0) {
 | 
			
		||||
        logger.notice(`Weekly mining pools hashrates indexing completed: indexed ${newlyIndexed}`);
 | 
			
		||||
      } else {
 | 
			
		||||
        logger.debug(`Weekly mining pools hashrates indexing completed: indexed ${newlyIndexed}`);
 | 
			
		||||
      }
 | 
			
		||||
      loadingIndicators.setProgress('weekly-hashrate-indexing', 100);
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
@ -339,9 +340,8 @@ class Mining {
 | 
			
		||||
          const runningFor = Math.max(1, Math.round((new Date().getTime() / 1000) - startedAt));
 | 
			
		||||
          const daysPerSeconds = Math.max(1, Math.round(indexedThisRun / elapsedSeconds));
 | 
			
		||||
          const progress = Math.round(totalIndexed / totalDayIndexed * 10000) / 100;
 | 
			
		||||
          const timeLeft = Math.round((totalDayIndexed - totalIndexed) / daysPerSeconds);
 | 
			
		||||
          const formattedDate = new Date(fromTimestamp).toUTCString();
 | 
			
		||||
          logger.debug(`Getting network daily hashrate for ${formattedDate} | ~${daysPerSeconds.toFixed(2)} days/sec | total: ~${totalIndexed}/${Math.round(totalDayIndexed)} (${progress}%) | elapsed: ${runningFor} seconds | left: ~${timeLeft} seconds`);
 | 
			
		||||
          logger.debug(`Getting network daily hashrate for ${formattedDate} | ~${daysPerSeconds.toFixed(2)} days/sec | total: ~${totalIndexed}/${Math.round(totalDayIndexed)} (${progress}%) | elapsed: ${runningFor} seconds`);
 | 
			
		||||
          timer = new Date().getTime() / 1000;
 | 
			
		||||
          indexedThisRun = 0;
 | 
			
		||||
          loadingIndicators.setProgress('daily-hashrate-indexing', progress);
 | 
			
		||||
@ -369,6 +369,8 @@ class Mining {
 | 
			
		||||
      await HashratesRepository.$setLatestRun('last_hashrates_indexing', new Date().getUTCDate());
 | 
			
		||||
      if (newlyIndexed > 0) {
 | 
			
		||||
        logger.notice(`Daily network hashrate indexing completed: indexed ${newlyIndexed} days`);
 | 
			
		||||
      } else {
 | 
			
		||||
        logger.debug(`Daily network hashrate indexing completed: indexed ${newlyIndexed} days`);
 | 
			
		||||
      }
 | 
			
		||||
      loadingIndicators.setProgress('daily-hashrate-indexing', 100);
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
@ -446,6 +448,8 @@ class Mining {
 | 
			
		||||
 | 
			
		||||
    if (totalIndexed > 0) {
 | 
			
		||||
      logger.notice(`Indexed ${totalIndexed} difficulty adjustments`);
 | 
			
		||||
    } else {
 | 
			
		||||
      logger.debug(`Indexed ${totalIndexed} difficulty adjustments`);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -446,7 +446,7 @@ class BlocksRepository {
 | 
			
		||||
        ++idx;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      logger.info(`${idx} blocks hash validated in ${new Date().getTime() - start} ms`);
 | 
			
		||||
      logger.debug(`${idx} blocks hash validated in ${new Date().getTime() - start} ms`);
 | 
			
		||||
      return true;
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      logger.err('Cannot validate chain of block hash. Reason: ' + (e instanceof Error ? e.message : e));
 | 
			
		||||
 | 
			
		||||
@ -177,6 +177,8 @@ class PriceUpdater {
 | 
			
		||||
    }
 | 
			
		||||
    if (insertedCount > 0) {
 | 
			
		||||
      logger.notice(`Inserted ${insertedCount} MtGox USD weekly price history into db`);
 | 
			
		||||
    } else {
 | 
			
		||||
      logger.debug(`Inserted ${insertedCount} MtGox USD weekly price history into db`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Insert Kraken weekly prices
 | 
			
		||||
@ -251,6 +253,8 @@ class PriceUpdater {
 | 
			
		||||
 | 
			
		||||
    if (totalInserted > 0) {
 | 
			
		||||
      logger.notice(`Inserted ${totalInserted} hourly historical prices into the db`);
 | 
			
		||||
    } else {
 | 
			
		||||
      logger.debug(`Inserted ${totalInserted} hourly historical prices into the db`);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user