Skip to content

Commit 0dcbca7

Browse files
committed
lag by blocks for live polling
1 parent 722b0ec commit 0dcbca7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

configs/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type Config struct {
6161
CommitterCompressionThresholdMB int `env:"COMMITTER_COMPRESSION_THRESHOLD_MB" envDefault:"50"`
6262
CommitterKafkaBatchSize int `env:"COMMITTER_KAFKA_BATCH_SIZE" envDefault:"500"`
6363
CommitterIsLive bool `env:"COMMITTER_IS_LIVE" envDefault:"false"`
64+
CommitterLagByBlocks uint64 `env:"COMMITTER_LAG_BY_BLOCKS" envDefault:"0"`
6465
StagingS3Bucket string `env:"STAGING_S3_BUCKET" envDefault:"thirdweb-insight-production"`
6566
StagingS3Region string `env:"STAGING_S3_REGION" envDefault:"us-west-2"`
6667
StagingS3AccessKeyID string `env:"STAGING_S3_ACCESS_KEY_ID"`

internal/committer/poollatest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func pollLatest() error {
2929
// Update latest block number metric
3030
metrics.CommitterLatestBlockNumber.WithLabelValues(indexerName, chainIdStr).Set(float64(latestBlock.Uint64()))
3131

32-
if nextBlockNumber >= latestBlock.Uint64() {
32+
if nextBlockNumber+config.Cfg.CommitterLagByBlocks >= latestBlock.Uint64() {
3333
time.Sleep(250 * time.Millisecond)
3434
continue
3535
}

0 commit comments

Comments
 (0)