This commit is contained in:
2026-06-08 22:17:04 -05:00
parent e5c406e42d
commit 9c854bc1b9
+9
View File
@@ -464,6 +464,15 @@ fn register_write_api(engine: &mut Engine, queues: &QueueMap) {
}
});
// delay(secs): insert an explicit pause into the queue, merged with any trailing Delay.
let q = queues.clone();
engine.register_fn("delay", move |ctx: NativeCallContext, secs: f64| {
let src = source_of(&ctx);
if let Some(queue) = q.borrow().get(&src) {
push_delay(queue, secs.max(0.0));
}
});
// now(): pop the back of the queue and push it to the front.
// Use after a zero-cost action (say, log) to bypass any pending Delay.
let q = queues.clone();