[PATCH] Add singlethreadperfolder option.

James E. Blair corvus at gnu.org
Wed Jul 18 03:47:06 BST 2012


To further ensure that messages are synchronized strictly in UID
order, this option can be set to cause only one thread to be used
to synchronise an individual folder, though other folders may
be synchronized simultaneously by other threads.

Signed-off-by: James E. Blair <corvus at gnu.org>
---
 offlineimap.conf           |    9 +++++++++
 offlineimap/folder/IMAP.py |    5 +++++
 2 files changed, 14 insertions(+)

diff --git a/offlineimap.conf b/offlineimap.conf
index fccceab..8a653c4 100644
--- a/offlineimap.conf
+++ b/offlineimap.conf
@@ -411,6 +411,15 @@ remoteuser = username
 
 #maxconnections = 2
 
+# If you want to ensure that only a single thread is used to synchronize
+# each folder, set this to 'yes'.  If this is set, only one thread will
+# be used to copy messages for each folder, but up to maxconnections
+# threads will be used overall, copying different folders in parallel.
+# If this is unset (the default), then up to maxconnections threads are
+# used across all currently syncing folders.
+#
+#singlethreadperfolder = no
+
 # OfflineIMAP normally closes IMAP server connections between refreshes if
 # the global option autorefresh is specified.  If you wish it to keep the
 # connection open, set this to true.  If not specified, the default is
diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py
index bb1b51f..e92a86c 100644
--- a/offlineimap/folder/IMAP.py
+++ b/offlineimap/folder/IMAP.py
@@ -53,6 +53,11 @@ class IMAPFolder(BaseFolder):
             imapobj.select(self.getfullname(), readonly = True, force = force)
 
     def suggeststhreads(self):
+        onethread = self.config.getdefaultboolean(
+            "Repository %s" % self.repository.getname(),
+            "singlethreadperfolder", 0)
+        if onethread:
+            return 0
         return 1
 
     def waitforthread(self):
-- 
1.7.9.5





More information about the OfflineIMAP-project mailing list