From 05ab6c0f3ed4c818cba0a3cc15f0122e791c5cfc Mon Sep 17 00:00:00 2001 From: Connor Johnstone Date: Tue, 24 Mar 2026 21:32:25 -0400 Subject: [PATCH] speedup on tagging --- src/workers.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/workers.rs b/src/workers.rs index 781b1ec..e34916a 100644 --- a/src/workers.rs +++ b/src/workers.rs @@ -99,12 +99,6 @@ fn spawn_worker(state: web::Data, task_type: WorkTaskType, concurrency tokio::spawn(async move { loop { - // Wait for notification or poll timeout - tokio::select! { - _ = notify.notified() => {} - _ = tokio::time::sleep(std::time::Duration::from_secs(5)) => {} - } - // Claim pending items let items = match queries::work_queue::claim_next( state.db.conn(), @@ -122,6 +116,11 @@ fn spawn_worker(state: web::Data, task_type: WorkTaskType, concurrency }; if items.is_empty() { + // Nothing to do — wait for notification or poll timeout + tokio::select! { + _ = notify.notified() => {} + _ = tokio::time::sleep(std::time::Duration::from_secs(5)) => {} + } continue; }