lib.rs handled unwraps for errored deliveries

This commit is contained in:
2005 2024-10-25 23:38:19 +02:00
parent b0fc4e69e2
commit d0eba8fa34

View file

@ -241,10 +241,15 @@ impl BunBunWorker {
consumer
.for_each_concurrent(None, move |delivery| {
let handler = Arc::clone(&handler);
// TODO handle unwrap of delivery
let delivery = delivery.unwrap();
async move {
handler(delivery).await;
match delivery {
Err(error) => {
tracing::warn!("Received bad msg: {}", error);
}
Ok(delivery) => {
handler(delivery).await;
}
}
}
})
.await;
@ -263,10 +268,15 @@ impl BunBunWorker {
consumer
.for_each_concurrent(None, move |delivery| {
let handler = Arc::clone(&handler);
// TODO handle unwrap of delivery
let delivery = delivery.unwrap();
async move {
handler(delivery).await;
match delivery {
Err(error) => {
tracing::warn!("Received bad msg: {}", error);
}
Ok(delivery) => {
handler(delivery).await;
}
}
}
})
.await;