From b2fb1b406ea9fd2957eadfe2216dea44cd74b56e Mon Sep 17 00:00:00 2001 From: Tomasz Pietrek Date: Mon, 26 Aug 2024 14:08:20 +0200 Subject: [PATCH] Remove unwrap from consumer Although those unwraps seem safe, it's still better not not have app panicking at all. Even in case of those somehow failing, client will recover by itself on next iteration of the timer. Signed-off-by: Tomasz Pietrek --- async-nats/src/jetstream/consumer/pull.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/async-nats/src/jetstream/consumer/pull.rs b/async-nats/src/jetstream/consumer/pull.rs index dffd9f50d..52dc9d3e0 100644 --- a/async-nats/src/jetstream/consumer/pull.rs +++ b/async-nats/src/jetstream/consumer/pull.rs @@ -961,7 +961,7 @@ impl Stream { .into() })) .await - .unwrap(); + .ok(); trace!("result send over tx"); } } @@ -1092,7 +1092,7 @@ impl futures::Stream for Stream { && !self.pending_request { debug!("pending messages reached threshold to send new fetch request"); - self.request_tx.send(()).unwrap(); + self.request_tx.send(()).ok(); self.pending_request = true; }