summaryrefslogtreecommitdiffstats
path: root/pykolab/imap/__init__.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-12-02 11:00:34 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-12-02 13:39:52 +0100
commit10fa4efdae95fd3fc020bdcc03c9a7f34a7a7550 (patch)
tree09b0cbc176782f79eb62d9592b7a3968362c9b3c /pykolab/imap/__init__.py
parent43d3959952d0c41256d108ee5ee24e056e384558 (diff)
downloadpykolab-10fa4efdae95fd3fc020bdcc03c9a7f34a7a7550.tar.gz
Do not continue attempting to create sub-folders for a user's mailbox if the creation of the mailbox for the user has failed.
Reference T5881
Diffstat (limited to 'pykolab/imap/__init__.py')
-rw-r--r--pykolab/imap/__init__.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index ce5612f..26a7051 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -497,7 +497,19 @@ class IMAP(object):
folder_name = "user%s%s" % (self.get_separator(), mailbox_base_name)
log.info(_("Creating new mailbox for user %s") %(mailbox_base_name))
- self.create_folder(folder_name, server)
+ max_tries = 10
+ success = False
+ while not success and max_tries > 0:
+ success = self.create_folder(folder_name, server)
+ if not success:
+ self.disconnect()
+ max_tries -= 1
+ time.sleep(1)
+ self.connect()
+
+ if not success:
+ log.error(_("Could not create the mailbox for user %s, aborting." % (mailbox_base_name)))
+ return False
# In a Cyrus IMAP Murder topology, wait for the murder to have settled
if self.imap_murder():