Skip to content

Commit

Permalink
fix skip block handling
Browse files Browse the repository at this point in the history
  • Loading branch information
billettc committed Apr 23, 2024
1 parent 726964a commit c25968e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion blockpoller/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ func (p *BlockPoller) run(resolvedStartBlock bstream.BlockRef, numberOfBlockToFe
fetchedBlockItem := <-requestedBlockItem

if fetchedBlockItem.skipped {
numberOfBlockToFetch++
p.logger.Info("block was skipped", zap.Uint64("block_num", fetchedBlockItem.blockNumber))
blockToFetch++
continue
}

Expand Down Expand Up @@ -275,6 +276,7 @@ func (p *BlockPoller) loadNextBlocks(requestedBlock uint64, numberOfBlockToFetch
}

func (p *BlockPoller) requestBlock(blockNumber uint64, numberOfBlockToFetch int) chan *BlockItem {
p.logger.Info("requesting block", zap.Uint64("block_num", blockNumber))
requestedBlock := make(chan *BlockItem)

go func(requestedBlock chan *BlockItem) {
Expand All @@ -297,6 +299,7 @@ func (p *BlockPoller) requestBlock(blockNumber uint64, numberOfBlockToFetch int)

p.logger.Info("block was optimistically polled", zap.Uint64("block_num", blockNumber))
requestedBlock <- blockItem
close(requestedBlock)
break
}

Expand Down

0 comments on commit c25968e

Please sign in to comment.