Skip to content

Commit

Permalink
[chore] new log on recover blocks and reduce to 10 blocks (#1048)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo Vieira authored Nov 21, 2023
1 parent cf3979e commit d2fa91d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/worker/src/chainSubscribers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ class ChainSubscribers {
try {
const r = await this._getLogs(startFromBlock, provider);
rawLogs = r.logs;
utils.Logger.info(`Got logs from main provider! Start from block ${startFromBlock} to ${r.toBlock}.`);
startFromBlock = r.toBlock;
isLastBlock = r.isLastBlock;
utils.Logger.info('Got logs from main provider!');
} catch (error) {
utils.Logger.error('Failed to get logs from main provider!', error);
const r = await this._getLogs(startFromBlock, fallbackProvider);
Expand Down Expand Up @@ -135,7 +135,7 @@ class ChainSubscribers {
*/
async _getLogs(startFromBlock: number, provider: ethers.providers.JsonRpcProvider) {
const lastBlock = await provider.getBlockNumber();
const toBlock = lastBlock - startFromBlock > 100 ? startFromBlock + 100 : lastBlock;
const toBlock = lastBlock - startFromBlock > 10 ? startFromBlock + 10 : lastBlock;
const logs = await provider.getLogs({
fromBlock: startFromBlock,
toBlock,
Expand Down

0 comments on commit d2fa91d

Please sign in to comment.