IMAP IDLE cleanup(1): Move idle callback out of loop
Don't redefine the idle callback function on every run in the while loop, define it once when we enter the function. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
5cbec30b3e
commit
f369961a87
@ -493,11 +493,6 @@ class IdleThread(object):
|
||||
ui.unregisterthread(currentThread())
|
||||
|
||||
def idle(self):
|
||||
while True:
|
||||
if self.event.isSet():
|
||||
return
|
||||
self.needsync = False
|
||||
self.imapaborted = False
|
||||
def callback(args):
|
||||
result, cb_arg, exc_data = args
|
||||
if exc_data is None:
|
||||
@ -509,6 +504,12 @@ class IdleThread(object):
|
||||
self.imapaborted = True
|
||||
self.stop()
|
||||
|
||||
while True:
|
||||
if self.event.isSet():
|
||||
return
|
||||
self.needsync = False
|
||||
self.imapaborted = False
|
||||
|
||||
success = False # successfully selected FOLDER?
|
||||
while not success:
|
||||
imapobj = self.parent.acquireconnection()
|
||||
|
Loading…
Reference in New Issue
Block a user