From d1da40bab75f01a50a326af401e0bf172931f363 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Fri, 19 Aug 2022 11:51:08 -0600 Subject: [PATCH] add config option for setting check_timeout (#343) --- README.rst | 1 + docs/index.rst | 1 + parsedmarc/cli.py | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/README.rst b/README.rst index f2f6dd3..003de1b 100644 --- a/README.rst +++ b/README.rst @@ -204,6 +204,7 @@ The full set of configuration options are: - ``delete`` - bool: Delete messages after processing them, instead of archiving them - ``test`` - bool: Do not move or delete messages - ``batch_size`` - int: Number of messages to read and process before saving. Default 10. Use 0 for no limit. + - ``check_timeout`` - int: Number of seconds to wait for a IMAP IDLE response or the number of seconds until the next mail check (Default: 30) - ``imap`` - ``host`` - str: The IMAP server hostname or IP address diff --git a/docs/index.rst b/docs/index.rst index b892bcf..ef63378 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -196,6 +196,7 @@ The full set of configuration options are: - ``delete`` - bool: Delete messages after processing them, instead of archiving them - ``test`` - bool: Do not move or delete messages - ``batch_size`` - int: Number of messages to read and process before saving. Default 10. Use 0 for no limit. + - ``check_timeout`` - int: Number of seconds to wait for a IMAP IDLE response or the number of seconds until the next mail check (Default: 30) - ``imap`` - ``host`` - str: The IMAP server hostname or IP address diff --git a/parsedmarc/cli.py b/parsedmarc/cli.py index 2012606..2b6f17a 100644 --- a/parsedmarc/cli.py +++ b/parsedmarc/cli.py @@ -276,6 +276,7 @@ def _main(): mailbox_delete=False, mailbox_test=False, mailbox_batch_size=None, + mailbox_check_timeout=30, imap_host=None, imap_skip_certificate_verification=False, imap_ssl=True, @@ -412,6 +413,8 @@ def _main(): opts.mailbox_test = mailbox_config.getboolean("test") if "batch_size" in mailbox_config: opts.mailbox_batch_size = mailbox_config.getint("batch_size") + if "check_timeout" in mailbox_config: + opts.mailbox_check_timeout = mailbox_config.getint("check_timeout") if "imap" in config.sections(): imap_config = config["imap"] @@ -989,6 +992,7 @@ def _main(): archive_folder=opts.mailbox_archive_folder, delete=opts.mailbox_delete, test=opts.mailbox_test, + check_timeout=opts.mailbox_check_timeout, nameservers=opts.nameservers, dns_timeout=opts.dns_timeout, strip_attachment_payloads=opts.strip_attachment_payloads,