Skip to content

Commit 8012a09

Browse files
max reconstruction delay as a function of slot time
1 parent 5928407 commit 8012a09

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

beacon_node/beacon_processor/src/scheduler/work_reprocessing_queue.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ pub const BACKFILL_SCHEDULE_IN_SLOT: [(u32, u32); 3] = [
8282
(4, 5),
8383
];
8484

85-
/// Trigger reconstruction if we are this many seconds into the current slot
86-
pub const RECONSTRUCTION_DEADLINE: Duration = Duration::from_millis(3000);
85+
/// Fraction of slot duration after which column reconstruction is triggered, makes it easier for
86+
/// different slot timings to have a generalised deadline
87+
pub const RECONSTRUCTION_DEADLINE: f64 = 0.25;
8788

8889
/// Messages that the scheduler can receive.
8990
#[derive(AsRefStr)]
@@ -754,13 +755,17 @@ impl<S: SlotClock> ReprocessQueue<S> {
754755
}
755756
InboundEvent::Msg(DelayColumnReconstruction(request)) => {
756757
let mut reconstruction_delay = QUEUED_RECONSTRUCTION_DELAY;
758+
let slot_duration = self.slot_clock.slot_duration().as_millis() as f64;
759+
let reconstruction_deadline_millis =
760+
(slot_duration * RECONSTRUCTION_DEADLINE).floor() as u64;
761+
let reconstruction_deadline = Duration::from_millis(reconstruction_deadline_millis);
757762
if let Some(seconds_from_current_slot) =
758763
self.slot_clock.seconds_from_current_slot_start()
759764
&& let Some(current_slot) = self.slot_clock.now()
760-
&& seconds_from_current_slot >= RECONSTRUCTION_DEADLINE
765+
&& seconds_from_current_slot >= reconstruction_deadline
761766
&& current_slot == request.slot
762767
{
763-
// If we are at least `RECONSTRUCTION_DEADLINE` seconds into the current slot,
768+
// If we are at least `reconstruction_deadline` seconds into the current slot,
764769
// and the reconstruction request is for the current slot, process reconstruction immediately.
765770
reconstruction_delay = Duration::from_secs(0);
766771
}

0 commit comments

Comments
 (0)