Skip to content

Commit

Permalink
fix data fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
defi-dev committed Dec 14, 2023
1 parent edb1fae commit f3b812d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ export class Network {
this.clog('info', `Sync diff between sources: ${diff}. Start fetching this blocks manually...`);

const step = 10;
while (diff > step) {
do {
const count = diff > step ? step : diff;
const before = this.nowMs();
const blocks = await pIteration.map(Array.from(Array(Number(count)).keys()), n => {
return this.queryBlock(+n + 1);
return this.queryBlock(startBlockNumber + n + 1);
});

blocks.forEach(block => this._handleNewBlock(block, before));
Expand All @@ -387,7 +387,8 @@ export class Network {

startBlockNumber += count;
diff = parseInt(await this.queryLatestBlock().then(b => b.number.toString())) - startBlockNumber;
}
} while (diff > step);

this.contractEventsEmitter.setBlockLogsMode(false);
}
}
Expand Down

0 comments on commit f3b812d

Please sign in to comment.