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