Skip to content

Commit

Permalink
only flush after holocene
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Oct 10, 2024
1 parent 5225b43 commit 118593a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions crates/derive/src/stages/batch_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@ where
}
BatchValidity::Drop => {
// If we drop a batch, flush previous batches buffered in the BatchStream
// stage.
self.prev.flush();
// stage if holocene is active.
if self.cfg.is_holocene_active(origin.timestamp) {
self.prev.flush();
}
warn!(target: "batch-queue", "Dropping batch with parent: {}", parent.block_info);
continue;
}
Expand Down Expand Up @@ -265,10 +267,13 @@ where
let validity =
data.check_batch(&self.cfg, &self.l1_blocks, parent, &mut self.fetcher).await;
// Post-Holocene, future batches are dropped due to prevent gaps.
let drop = validity.is_drop() ||
(self.cfg.is_holocene_active(origin.timestamp) && validity.is_future());
let is_holocene = self.cfg.is_holocene_active(origin.timestamp);
let drop = validity.is_drop() || (is_holocene && validity.is_future());
if drop {
self.prev.flush();
// If holocene is active, we don't flush the active span / channel.
if is_holocene {
self.prev.flush();
}
return Ok(());
} else if validity.is_outdated() {
// If the batch is outdated, we drop it without flushing the previous stage.
Expand Down

0 comments on commit 118593a

Please sign in to comment.