threading: improve variable names and factorize code
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
@ -134,7 +134,7 @@ class BaseFolder(object):
|
||||
|
||||
return True
|
||||
|
||||
def getcopyinstancelimit(self):
|
||||
def getinstancelimitnamespace(self):
|
||||
"""For threading folders, returns the instancelimitname for
|
||||
InstanceLimitedThreads."""
|
||||
|
||||
@ -872,7 +872,7 @@ class BaseFolder(object):
|
||||
if self.suggeststhreads() and not globals.options.singlethreading:
|
||||
self.waitforthread()
|
||||
thread = threadutil.InstanceLimitedThread(
|
||||
self.getcopyinstancelimit(),
|
||||
self.getinstancelimitnamespace(),
|
||||
target = self.copymessageto,
|
||||
name = "Copy message from %s:%s" % (self.repository, self),
|
||||
args = (uid, dstfolder, statusfolder)
|
||||
|
@ -32,6 +32,7 @@ import six
|
||||
|
||||
# Globals
|
||||
CRLF = '\r\n'
|
||||
MSGCOPY_NAMESPACE = 'MSGCOPY_'
|
||||
|
||||
|
||||
# NB: message returned from getmessage() will have '\n' all over the place,
|
||||
@ -88,8 +89,8 @@ class IMAPFolder(BaseFolder):
|
||||
OfflineImapError.ERROR.REPO), None, exc_info()[2])
|
||||
|
||||
# Interface from BaseFolder
|
||||
def getcopyinstancelimit(self):
|
||||
return 'MSGCOPY_' + self.repository.getname()
|
||||
def getinstancelimitnamespace(self):
|
||||
return MSGCOPY_NAMESPACE + self.repository.getname()
|
||||
|
||||
# Interface from BaseFolder
|
||||
def get_uidvalidity(self):
|
||||
|
Reference in New Issue
Block a user