threading: suggeststhreads must honor CLI and conf options

There's no need to honor them twice.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-05-18 02:48:40 +02:00
parent e0fdcb3852
commit 46a6bcbf1c

View File

@ -21,7 +21,6 @@ import time
from sys import exc_info from sys import exc_info
from offlineimap import threadutil from offlineimap import threadutil
from offlineimap import globals
from offlineimap.ui import getglobalui from offlineimap.ui import getglobalui
from offlineimap.error import OfflineImapError from offlineimap.error import OfflineImapError
import offlineimap.accounts import offlineimap.accounts
@ -112,9 +111,12 @@ class BaseFolder(object):
return self.repository.should_sync_folder(self.ffilter_name) return self.repository.should_sync_folder(self.ffilter_name)
def suggeststhreads(self): def suggeststhreads(self):
"""Returns true if this folder suggests using threads for actions; """Returns True if this folder suggests using threads for actions.
false otherwise. Probably only IMAP will return true."""
return 0 Only IMAP returns True. This method must honor any CLI or configuration
option."""
return False
def waitforthread(self): def waitforthread(self):
"""Implements method that waits for thread to be usable. """Implements method that waits for thread to be usable.
@ -869,7 +871,7 @@ class BaseFolder(object):
self.ui.copyingmessage(uid, num+1, num_to_copy, self, dstfolder) self.ui.copyingmessage(uid, num+1, num_to_copy, self, dstfolder)
# exceptions are caught in copymessageto() # exceptions are caught in copymessageto()
if self.suggeststhreads() and not globals.options.singlethreading: if self.suggeststhreads():
self.waitforthread() self.waitforthread()
thread = threadutil.InstanceLimitedThread( thread = threadutil.InstanceLimitedThread(
self.getinstancelimitnamespace(), self.getinstancelimitnamespace(),