speedup on tagging

This commit is contained in:
Connor Johnstone
2026-03-24 21:32:25 -04:00
parent c5efe23d01
commit 05ab6c0f3e

View File

@@ -99,12 +99,6 @@ fn spawn_worker(state: web::Data<AppState>, task_type: WorkTaskType, concurrency
tokio::spawn(async move { tokio::spawn(async move {
loop { loop {
// Wait for notification or poll timeout
tokio::select! {
_ = notify.notified() => {}
_ = tokio::time::sleep(std::time::Duration::from_secs(5)) => {}
}
// Claim pending items // Claim pending items
let items = match queries::work_queue::claim_next( let items = match queries::work_queue::claim_next(
state.db.conn(), state.db.conn(),
@@ -122,6 +116,11 @@ fn spawn_worker(state: web::Data<AppState>, task_type: WorkTaskType, concurrency
}; };
if items.is_empty() { 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; continue;
} }