Reduce IMAP IDLE refresh rate to 5 minutes

G-Suite is resetting connections after 10 minutes
This commit is contained in:
Sean Whalen
2018-09-05 04:55:46 -04:00
committed by GitHub
parent 7c6a0b185a
commit f19d623d7d
+3 -3
View File
@@ -1438,9 +1438,9 @@ def watch_inbox(host, username, password, callback, reports_folder="INBOX",
while True:
try:
# Refresh the IDLE session every 10 minutes to stay connected
if time.monotonic() - idle_start_time > 10 * 60:
logger.info("IMAP: Refreshing IDLE session")
# Refresh the IDLE session every 5 minutes to stay connected
if time.monotonic() - idle_start_time > 5 * 60:
logger.debug("IMAP: Refreshing IDLE session")
server.idle_done()
server.idle()
idle_start_time = time.monotonic()