Skip to content

Commit

Permalink
attempt reducing cpu load by handling queue items one by one
Browse files Browse the repository at this point in the history
  • Loading branch information
tsunyoku committed May 2, 2024
1 parent f342931 commit 0fa8fba
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,19 +454,16 @@ async fn rmq_listen(context: Arc<Context>) -> anyhow::Result<()> {
deserialized_data.rework_id
);

let context_clone = context.clone();
tokio::spawn(async move {
let result = handle_queue_request(
deserialized_data,
context_clone,
delivery.delivery_tag.clone(),
)
.await;

if result.is_err() {
log::error!(error = result.unwrap_err().to_string(); "Error processing queue request");
}
});
let result = handle_queue_request(
deserialized_data,
context.clone(),
delivery.delivery_tag.clone(),
)
.await;

if result.is_err() {
log::error!(error = result.unwrap_err().to_string(); "Error processing queue request");
}
}

tokio::time::sleep(Duration::from_millis(100)).await;
Expand Down

0 comments on commit 0fa8fba

Please sign in to comment.