fix: log terminal connect exhaustion so a dead connection isn't silent

_connect_locked logged a per-attempt WARNING but returned False on exhaustion with no
terminal line - the per-attempt lines were the only trace, so a genuinely dead IMAP
connection could read as routine retry noise with no loud terminal signal (rule-3 guard:
a swallow-to-default must carry a terminal log, and demoting/relying only on attempt lines
would leave it silent). add a terminal WARNING before the False return; keep the
per-attempt WARNING. host only (no creds) in the message.

Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
2026-08-09 02:13:44 -04:00
parent d827618075
commit 1f24198121
+5
View File
@@ -93,6 +93,11 @@ class IMAPClient:
self._mail = None
if attempt < self.max_retries - 1:
await asyncio.sleep(2 * (attempt + 1))
# terminal signal: all attempts are exhausted and this SWALLOWS the failure into a
# False return the caller branches on. without this line the per-attempt WARNINGs are
# the only trace, so a genuinely dead connection could look like routine noise - log
# the terminal exhaustion loudly so real degradation is visible, then return False.
log.warning("connect to %s failed after %d attempts", self.host, self.max_retries)
return False
@staticmethod