From 45d8566ec02b91a71ee2156e2a193aec1f2ec6c9 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 20 Jul 2025 13:29:16 +0000 Subject: [PATCH] fix: do not ignore errors when draining FETCH responses --- src/imap.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/imap.rs b/src/imap.rs index 7b8de333e..55834376e 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -1491,7 +1491,16 @@ impl Session { // If we don't process the whole response, IMAP client is left in a broken state where // it will try to process the rest of response as the next response. - while fetch_responses.next().await.is_some() {} + // + // Make sure to not ignore the errors, because + // if connection times out, it will return + // infinite stream of `Some(Err(_))` results. + while fetch_responses + .try_next() + .await + .context("Failed to drain FETCH responses")? + .is_some() + {} if count != request_uids.len() { warn!(