From 70ff13bfaed05476416112ad52857e6a6a2e5529 Mon Sep 17 00:00:00 2001 From: Anael Mobilia Date: Sat, 24 Dec 2022 00:23:01 +0100 Subject: [PATCH] In case of timeout or exception, wait "check_timeout" before to try a new connexion (documentation : "or the number of seconds until the next mail check"). (#377) Else in case of a mail server issue, we try to connect again each 5 seconds. --- parsedmarc/mail/imap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parsedmarc/mail/imap.py b/parsedmarc/mail/imap.py index 8e7aba7..150185e 100644 --- a/parsedmarc/mail/imap.py +++ b/parsedmarc/mail/imap.py @@ -69,8 +69,8 @@ class IMAPConnection(MailboxConnection): idle_timeout=check_timeout) except (timeout, IMAPClientError): logger.warning("IMAP connection timeout. Reconnecting...") - sleep(5) + sleep(check_timeout) except Exception as e: logger.warning("IMAP connection error. {0}. " "Reconnecting...".format(e)) - sleep(5) + sleep(check_timeout)