speedup on tagging
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user