Skip to content

Commit

Permalink
Fix ETA with endBlock (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
DZakh authored Dec 23, 2024
1 parent 12f5cce commit 10b9dcd
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ let isIndexerFullySynced = (chains: array<ChainData.chainData>) => {
}

let getTotalRemainingBlocks = (chains: array<ChainData.chainData>) => {
chains->Array.reduce(0, (accum, {progress, currentBlockHeight, latestFetchedBlockNumber}) => {
chains->Array.reduce(0, (accum, {progress, currentBlockHeight, latestFetchedBlockNumber, endBlock}) => {
let finalBlock = switch endBlock {
| Some(endBlock) => endBlock
| None => currentBlockHeight
}
switch progress {
| Syncing({latestProcessedBlock})
| Synced({latestProcessedBlock}) =>
currentBlockHeight - latestProcessedBlock + accum
| SearchingForEvents => currentBlockHeight - latestFetchedBlockNumber + accum
finalBlock - latestProcessedBlock + accum
| SearchingForEvents => finalBlock - latestFetchedBlockNumber + accum
}
})
}
Expand Down

0 comments on commit 10b9dcd

Please sign in to comment.