mirror of
https://github.com/domainaware/parsedmarc.git
synced 2026-05-09 13:35:25 +00:00
Detecting other IMAP-errors. Adding short sleep to avoid hammering the IMAP-server on error
This commit is contained in:
@@ -8,6 +8,7 @@ import shutil
|
||||
import xml.parsers.expat as expat
|
||||
import json
|
||||
from datetime import datetime
|
||||
from time import sleep
|
||||
from collections import OrderedDict
|
||||
from io import BytesIO, StringIO
|
||||
from gzip import GzipFile
|
||||
@@ -1234,6 +1235,10 @@ def watch_inbox(host, username, password, callback, port=None, ssl=True,
|
||||
idle_timeout=idle_timeout)
|
||||
except (timeout, IMAPClientError):
|
||||
logger.warning("IMAP connection timeout. Reconnecting...")
|
||||
sleep(5)
|
||||
except Exception as e:
|
||||
logger.warning("IMAP connection error. {0}. Reconnecting...".format(e))
|
||||
sleep(5)
|
||||
|
||||
|
||||
def save_output(results, output_directory="output"):
|
||||
|
||||
Reference in New Issue
Block a user