From a4e4ea23f54a3171bf9c2a0cabc9fab31d8069b2 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 1 May 2024 06:12:56 -0700 Subject: [PATCH] ready_queue: maintainer_task: run a couple of times on startup I've seen some flakey behavior in some of the low traffic integration tests, where it looks like the maintainer isn't triggering to establish connections. This commit adjusts the logic in the maintainer_task to trigger the maintainer a handful of times over the first few seconds of its life to account for timing issues when setting up a new ready queue on a busy server. --- crates/kumod/src/ready_queue.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/kumod/src/ready_queue.rs b/crates/kumod/src/ready_queue.rs index d4dd3302..4f300560 100644 --- a/crates/kumod/src/ready_queue.rs +++ b/crates/kumod/src/ready_queue.rs @@ -241,12 +241,15 @@ impl ReadyQueueManager { // enqueued. In that case we don't notice the wakup on // `notify` in a timely manner and we'll sit waiting // for a subsequent message. - { + // We'll do this a couple of times at startup before + // falling into the main loop below + for _ in 0..4 { let mgr = Self::get().await; if let Some(queue) = mgr.queues.get(&name).cloned() { let mut queue = queue.lock().await; queue.maintain().await; } + tokio::time::sleep(Duration::from_secs(1)).await; } loop {