Skip to content

Commit 8f2eaf9

Browse files
committed
polling block stream: Reset block range size to 1
1 parent d59e715 commit 8f2eaf9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

graph/src/blockchain/polling_block_stream.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ use crate::prelude::*;
2020
#[cfg(debug_assertions)]
2121
use fail::fail_point;
2222

23+
// A high number here forces a slow start.
24+
const STARTING_PREVIOUS_TRIGGERS_PER_BLOCK: f64 = 1_000_000.0;
25+
2326
enum BlockStreamState<C>
2427
where
2528
C: Blockchain,
@@ -178,9 +181,7 @@ where
178181
filter,
179182
start_blocks,
180183
metrics,
181-
182-
// A high number here forces a slow start, with a range of 1.
183-
previous_triggers_per_block: 1_000_000.0,
184+
previous_triggers_per_block: STARTING_PREVIOUS_TRIGGERS_PER_BLOCK,
184185
previous_block_range_size: 1,
185186
max_block_range_size,
186187
target_triggers_per_block_range,
@@ -555,7 +556,8 @@ impl<C: Blockchain> Stream for PollingBlockStream<C> {
555556
Poll::Ready(Err(e)) => {
556557
// Reset the block range size in an attempt to recover from the error.
557558
// See also: 018c6df4-132f-4acc-8697-a2d64e83a9f0
558-
self.ctx.previous_block_range_size = 1;
559+
self.ctx.previous_triggers_per_block =
560+
STARTING_PREVIOUS_TRIGGERS_PER_BLOCK;
559561
self.consecutive_err_count += 1;
560562

561563
// Pause before trying again

0 commit comments

Comments
 (0)