summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-12-13 11:03:59 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-12-13 11:37:50 +0100
commitdf69259ba359d1fc01427e102f407c2360ed459f (patch)
tree1ae8938648bfba64f0aa56d60dd7170fc1271dd8
parentd861c2455dda066b7b62da86451ad8e251fb9c14 (diff)
downloadpykolab-df69259ba359d1fc01427e102f407c2360ed459f.tar.gz
Retry finding a folder in a murder for 30 seconds, then reconnect
When disconnecting an unqualified connection, eliminate all connections
-rw-r--r--pykolab/imap/__init__.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 26a7051..47625e1 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -216,6 +216,11 @@ class IMAP(object):
# No server specified, but make sure self.imap is None anyways
if hasattr(self, 'imap'):
del self.imap
+
+ # Empty out self._imap as well
+ for key in self._imap.keys():
+ del self._imap[key]
+
else:
if self._imap.has_key(server):
del self._imap[server]
@@ -652,6 +657,11 @@ class IMAP(object):
if not created:
if time.time() - last_log > 5:
log.info(_("Waiting for the Cyrus IMAP Murder to settle..."))
+ if time.time() - last_log > 30:
+ log.warning(_("Waited for 30 seconds, going to reconnect"))
+ self.disconnect()
+ self.connec()
+
last_log = time.time()
time.sleep(0.5)