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.
This commit is contained in:
Wez Furlong
2024-05-01 06:15:09 -07:00
parent 57565514d9
commit a4e4ea23f5
+4 -1
View File
@@ -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 {