Skip to content

Commit 4a44c63

Browse files
thomasywangfacebook-github-bot
authored andcommitted
Configurable debounce
Summary: When we increase the number of actors in our simulation it takes longer for all the events at a certain time to complete so we need to wait for longer. If we wait to long then the simulation just runs slower than it needs to so its nice to make this configurable. In the long term we will come up with a more robust solution to this but in the meantime that is not a priority. See EX528476 to understand the underlying problem the debounce is remedying Differential Revision: D80137965
1 parent 3c1d264 commit 4a44c63

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

hyperactor/src/simnet.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,14 +567,23 @@ impl SimNet {
567567
let mut training_script_waiting_time: u64 = 0;
568568
// Duration elapsed while only non_advanceable_events has events
569569
let mut debounce_timer: Option<tokio::time::Instant> = None;
570+
571+
let debounce_duration = std::env::var("SIM_DEBOUNCE")
572+
.ok()
573+
.and_then(|val| val.parse::<u64>().ok())
574+
.unwrap_or(1);
575+
570576
'outer: loop {
571577
// Check if we should stop
572578
if stop_signal.load(Ordering::SeqCst) {
573579
break 'outer self.records.clone();
574580
}
575581

576582
while let Ok(Some((event, advanceable, time))) = RealClock
577-
.timeout(tokio::time::Duration::from_millis(1), event_rx.recv())
583+
.timeout(
584+
tokio::time::Duration::from_millis(debounce_duration),
585+
event_rx.recv(),
586+
)
578587
.await
579588
{
580589
let scheduled_event = match time {

0 commit comments

Comments
 (0)