From 59df0b0af1893943c486266ee68a0ea375dd8677 Mon Sep 17 00:00:00 2001 From: Lyudmil Danailov Date: Mon, 27 Nov 2023 14:54:52 +0200 Subject: [PATCH] Minor tweaks --- blockchains/eth/lib/constants.js | 24 +++++++++---------- .../eth/lib/next_interval_calculator.js | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/blockchains/eth/lib/constants.js b/blockchains/eth/lib/constants.js index 5a0e2180..26349708 100644 --- a/blockchains/eth/lib/constants.js +++ b/blockchains/eth/lib/constants.js @@ -12,16 +12,16 @@ const NODE_URL = process.env.NODE_URL || process.env.PARITY_URL || 'http://local const LOOP_INTERVAL_CURRENT_MODE_SEC = parseInt(process.env.LOOP_INTERVAL_CURRENT_MODE_SEC || '30'); module.exports = { - IS_ETH, - NODE_URL, - MAX_RETRIES, - BURN_ADDRESS, - CONFIRMATIONS, - BLOCK_INTERVAL, - ETH_WITHDRAWAL, - LONDON_FORK_BLOCK, - SHANGHAI_FORK_BLOCK, - RECEIPTS_API_METHOD, - MAX_CONCURRENT_REQUESTS, - LOOP_INTERVAL_CURRENT_MODE_SEC + IS_ETH, + NODE_URL, + MAX_RETRIES, + BURN_ADDRESS, + CONFIRMATIONS, + BLOCK_INTERVAL, + ETH_WITHDRAWAL, + LONDON_FORK_BLOCK, + SHANGHAI_FORK_BLOCK, + RECEIPTS_API_METHOD, + MAX_CONCURRENT_REQUESTS, + LOOP_INTERVAL_CURRENT_MODE_SEC }; diff --git a/blockchains/eth/lib/next_interval_calculator.js b/blockchains/eth/lib/next_interval_calculator.js index cc7129a4..5334fe02 100644 --- a/blockchains/eth/lib/next_interval_calculator.js +++ b/blockchains/eth/lib/next_interval_calculator.js @@ -3,7 +3,7 @@ const constants = require('./constants'); /** * A function that returns the appropriate array of intervals, * depending on the progress that the worker's made. - * @param {BaseWorker} worker The worker instance. + * @param {BaseWorker} worker A worker instance, inherriting the BaseWorker class. * @returns {Array} An array of intervals. */ async function nextIntervalCalculator(worker) { @@ -17,7 +17,7 @@ async function nextIntervalCalculator(worker) { } worker.sleepTimeMsec = 0; - const progressDifference = this.lastConfirmedBlock - this.lastExportedBlock; + const progressDifference = worker.lastConfirmedBlock - worker.lastExportedBlock; const maxInterval = constants.MAX_CONCURRENT_REQUESTS * constants.BLOCK_INTERVAL; let intervalArrayLength; if (progressDifference < maxInterval) {