learn singlethreadperfolder configuration option

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@gnu.org>
Based-on-patch-by: James E. Blair <corvus@gnu.org>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
James E. Blair 2012-07-17 19:47:06 -07:00 committed by Nicolas Sebrecht
parent a5ea1827fb
commit 560363ef73
2 changed files with 22 additions and 1 deletions

View File

@ -183,7 +183,7 @@ accounts = Test
# through eval, so you can (and must) use Python quoting. # through eval, so you can (and must) use Python quoting.
# #
# The incremental setting controls whether the file is written after each # The incremental setting controls whether the file is written after each
# account completes or once all synced accounts are complete. This is usefull if # account completes or once all synced accounts are complete. This is useful if
# an account is sightly slower than the other. It allows keeping the previous # an account is sightly slower than the other. It allows keeping the previous
# file rather than having it partially written. # file rather than having it partially written.
# This works best with "no" if in one-shot mode started by cron or systemd # This works best with "no" if in one-shot mode started by cron or systemd
@ -1016,6 +1016,22 @@ remoteuser = username
#maxconnections = 2 #maxconnections = 2
# This option stands in the [Repository RemoteExample] section.
#
# If you want to ensure that only one 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. This option is required to
# download in UIDs order.
#
# If this is unset (the default), then up to maxconnections threads are used
# across all currently syncing folders.
#
# This option is EXPERIMENTAL.
#
#singlethreadperfolder = no
# This option stands in the [Repository RemoteExample] section. # This option stands in the [Repository RemoteExample] section.
# #
# OfflineIMAP normally closes IMAP server connections between refreshes if # OfflineIMAP normally closes IMAP server connections between refreshes if

View File

@ -79,6 +79,11 @@ class IMAPFolder(BaseFolder):
# Interface from BaseFolder # Interface from BaseFolder
def suggeststhreads(self): def suggeststhreads(self):
onethread = self.config.getdefaultboolean(
"Repository %s"% self.repository.getname(),
"singlethreadperfolder", False)
if onethread is True:
return False
return not globals.options.singlethreading return not globals.options.singlethreading
# Interface from BaseFolder # Interface from BaseFolder