set singlethreadperfolder configuration option when in idle mode
Git-reference: https://github.com/OfflineIMAP/offlineimap/issues/376 Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
bd4b968f1d
commit
c287ecb7cc
@ -987,6 +987,7 @@ remoteuser = username
|
|||||||
# - maxconnections: to be at least the number of folders you give
|
# - maxconnections: to be at least the number of folders you give
|
||||||
# - holdconnectionopen: to be true
|
# - holdconnectionopen: to be true
|
||||||
# - keepalive: to be 29 minutes unless you specify otherwise
|
# - keepalive: to be 29 minutes unless you specify otherwise
|
||||||
|
# - singlethreadperfolder: to be true
|
||||||
#
|
#
|
||||||
# The presynchook and postsynchook are executed for each new synchronisation per
|
# The presynchook and postsynchook are executed for each new synchronisation per
|
||||||
# folder.
|
# folder.
|
||||||
|
@ -48,6 +48,7 @@ class IMAPFolder(BaseFolder):
|
|||||||
name = imaputil.dequote(name)
|
name = imaputil.dequote(name)
|
||||||
self.sep = imapserver.delim
|
self.sep = imapserver.delim
|
||||||
super(IMAPFolder, self).__init__(name, repository)
|
super(IMAPFolder, self).__init__(name, repository)
|
||||||
|
self.idle_mode = False
|
||||||
self.expunge = repository.getexpunge()
|
self.expunge = repository.getexpunge()
|
||||||
self.root = None # imapserver.root
|
self.root = None # imapserver.root
|
||||||
self.imapserver = imapserver
|
self.imapserver = imapserver
|
||||||
@ -61,6 +62,8 @@ class IMAPFolder(BaseFolder):
|
|||||||
# self.copy_ignoreUIDs is used by BaseFolder.
|
# self.copy_ignoreUIDs is used by BaseFolder.
|
||||||
self.copy_ignoreUIDs = repository.get_copy_ignore_UIDs(
|
self.copy_ignoreUIDs = repository.get_copy_ignore_UIDs(
|
||||||
self.getvisiblename())
|
self.getvisiblename())
|
||||||
|
if self.repository.getidlefolders() > 0:
|
||||||
|
self.idle_mode = True
|
||||||
|
|
||||||
|
|
||||||
def __selectro(self, imapobj, force=False):
|
def __selectro(self, imapobj, force=False):
|
||||||
@ -79,9 +82,13 @@ class IMAPFolder(BaseFolder):
|
|||||||
|
|
||||||
# Interface from BaseFolder
|
# Interface from BaseFolder
|
||||||
def suggeststhreads(self):
|
def suggeststhreads(self):
|
||||||
|
singlethreadperfolder_default = False
|
||||||
|
if self.idle_mode is True:
|
||||||
|
singlethreadperfolder_default = True
|
||||||
|
|
||||||
onethread = self.config.getdefaultboolean(
|
onethread = self.config.getdefaultboolean(
|
||||||
"Repository %s"% self.repository.getname(),
|
"Repository %s"% self.repository.getname(),
|
||||||
"singlethreadperfolder", False)
|
"singlethreadperfolder", singlethreadperfolder_default)
|
||||||
if onethread is True:
|
if onethread is True:
|
||||||
return False
|
return False
|
||||||
return not globals.options.singlethreading
|
return not globals.options.singlethreading
|
||||||
|
Loading…
Reference in New Issue
Block a user