Skip to content

Commit

Permalink
default poller retries infinite
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Feb 16, 2024
1 parent 764b793 commit 59b5025
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ If you were at `firehose-core` version `1.0.0` and are bumping to `1.1.0`, you s

* Poller is now handling skipped blocks, it will fetch the next blocks until it find a none skipped block.

* Poller now has default retry value of infinite.

* Compare tool is now using dynamic protobuf unmarshaler, it will be able to compare any block type.

* Print tool is now using dynamic protobuf unmarshaler, it will be able to print any block type.
Expand Down
8 changes: 5 additions & 3 deletions blockpoller/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package blockpoller
import (
"context"
"fmt"
"math"

"github.com/streamingfast/bstream"
"github.com/streamingfast/bstream/forkable"
Expand Down Expand Up @@ -50,7 +51,7 @@ func New(
Shutter: shutter.New(),
blockFetcher: blockFetcher,
blockHandler: blockHandler,
fetchBlockRetryCount: 4,
fetchBlockRetryCount: math.MaxUint64,
logger: zap.NewNop(),
forceFinalityAfterBlocks: utils.GetEnvForceFinalityAfterBlocks(),
}
Expand All @@ -62,10 +63,11 @@ func New(
return b
}

func (p *BlockPoller) Run(ctx context.Context, startBlockNum uint64, numberOfBlockToFetch int) error {
func (p *BlockPoller) Run(ctx context.Context, startBlockNum uint64, blockFetchBatchSize int) error {
p.startBlockNumGate = startBlockNum
p.logger.Info("starting poller",
zap.Uint64("start_block_num", startBlockNum),
zap.Uint64("block_fetch_batch_size", uint64(blockFetchBatchSize)),
)
p.blockHandler.Init()

Expand All @@ -78,7 +80,7 @@ func (p *BlockPoller) Run(ctx context.Context, startBlockNum uint64, numberOfBlo
startBlockNum++
continue
}
return p.run(startBlock.AsRef(), numberOfBlockToFetch)
return p.run(startBlock.AsRef(), blockFetchBatchSize)
}
}

Expand Down

0 comments on commit 59b5025

Please sign in to comment.