Skip to content

Commit e4acf92

Browse files
committed
feat: make reaper poll duration configurable
1 parent 66b491b commit e4acf92

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

block/components.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func NewAggregatorComponents(
227227
logger,
228228
executor,
229229
cacheManager,
230-
reaping.DefaultInterval,
230+
config.Node.ScrapeInterval.Duration,
231231
)
232232
if err != nil {
233233
return nil, fmt.Errorf("failed to create reaper: %w", err)

pkg/config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ const (
4949
FlagReadinessWindowSeconds = FlagPrefixEvnode + "node.readiness_window_seconds"
5050
// FlagReadinessMaxBlocksBehind configures how many blocks behind best-known head is still considered ready
5151
FlagReadinessMaxBlocksBehind = FlagPrefixEvnode + "node.readiness_max_blocks_behind"
52+
// FlagScrapeInterval is a flag for specifying the reaper scrape interval
53+
FlagScrapeInterval = FlagPrefixEvnode + "node.scrape_interval"
5254
// FlagClearCache is a flag for clearing the cache
5355
FlagClearCache = FlagPrefixEvnode + "clear_cache"
5456

@@ -203,6 +205,7 @@ type NodeConfig struct {
203205
MaxPendingHeadersAndData uint64 `mapstructure:"max_pending_headers_and_data" yaml:"max_pending_headers_and_data" comment:"Maximum number of headers or data pending DA submission. When this limit is reached, the aggregator pauses block production until some headers or data are confirmed. Use 0 for no limit."`
204206
LazyMode bool `mapstructure:"lazy_mode" yaml:"lazy_mode" comment:"Enables lazy aggregation mode, where blocks are only produced when transactions are available or after LazyBlockTime. Optimizes resources by avoiding empty block creation during periods of inactivity."`
205207
LazyBlockInterval DurationWrapper `mapstructure:"lazy_block_interval" yaml:"lazy_block_interval" comment:"Maximum interval between blocks in lazy aggregation mode (LazyAggregator). Ensures blocks are produced periodically even without transactions to keep the chain active. Generally larger than BlockTime."`
208+
ScrapeInterval DurationWrapper `mapstructure:"scrape_interval" yaml:"scrape_interval" comment:"Interval at which the reaper polls the execution layer for new transactions. Lower values reduce transaction detection latency but increase RPC load. Examples: \"250ms\", \"500ms\", \"1s\"."`
206209

207210
// Readiness / health configuration
208211
ReadinessWindowSeconds uint64 `mapstructure:"readiness_window_seconds" yaml:"readiness_window_seconds" comment:"Time window in seconds used to calculate ReadinessMaxBlocksBehind based on block time. Default: 15 seconds."`
@@ -337,6 +340,7 @@ func AddFlags(cmd *cobra.Command) {
337340
cmd.Flags().Duration(FlagLazyBlockTime, def.Node.LazyBlockInterval.Duration, "maximum interval between blocks in lazy aggregation mode")
338341
cmd.Flags().Uint64(FlagReadinessWindowSeconds, def.Node.ReadinessWindowSeconds, "time window in seconds for calculating readiness threshold based on block time (default: 15s)")
339342
cmd.Flags().Uint64(FlagReadinessMaxBlocksBehind, def.Node.ReadinessMaxBlocksBehind, "how many blocks behind best-known head the node can be and still be considered ready (0 = must be at head)")
343+
cmd.Flags().Duration(FlagScrapeInterval, def.Node.ScrapeInterval.Duration, "interval at which the reaper polls the execution layer for new transactions")
340344

341345
// Data Availability configuration flags
342346
cmd.Flags().String(FlagDAAddress, def.DA.Address, "DA address (host:port)")

pkg/config/defaults.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func DefaultConfig() Config {
6868
Light: false,
6969
ReadinessWindowSeconds: defaultReadinessWindowSeconds,
7070
ReadinessMaxBlocksBehind: calculateReadinessMaxBlocksBehind(defaultBlockTime.Duration, defaultReadinessWindowSeconds),
71+
ScrapeInterval: DurationWrapper{1 * time.Second},
7172
},
7273
DA: DAConfig{
7374
Address: "http://localhost:7980",

0 commit comments

Comments
 (0)