Skip to content

Commit f0327b6

Browse files
core: Fix subgraph scanning past endBlock when endBlock has no triggers
1 parent 1d60c3d commit f0327b6

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • core/src/subgraph/runner

core/src/subgraph/runner/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,18 @@ where
555555
.observe(block.trigger_count() as f64);
556556
}
557557

558-
// Check if we should skip this block (optimization for blocks without triggers)
558+
// Check if we should skip this block (optimization for blocks without triggers).
559+
// Do not skip if max_end_block has been reached — fall through to process_block so the
560+
// block pointer is persisted and the existing max_end_block check in handle_action fires.
561+
let max_end_block_reached = self
562+
.inputs
563+
.max_end_block
564+
.is_some_and(|max| block_ptr.number >= max);
559565
if block.trigger_count() == 0
560566
&& self.state.skip_ptr_updates_timer.elapsed() <= SKIP_PTR_UPDATES_THRESHOLD
561567
&& !self.inputs.store.is_deployment_synced()
562568
&& !close_to_chain_head(&block_ptr, &self.inputs.chain.chain_head_ptr().await?, 1000)
569+
&& !max_end_block_reached
563570
{
564571
// Skip this block and continue with the same stream
565572
return Ok(RunnerState::AwaitingBlock { block_stream });

0 commit comments

Comments
 (0)