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,21 +493,22 @@ class IdleThread(object):
|
|||||||
ui.unregisterthread(currentThread())
|
ui.unregisterthread(currentThread())
|
||||||
|
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
def callback(args):
|
||||||
|
result, cb_arg, exc_data = args
|
||||||
|
if exc_data is None:
|
||||||
|
if not self.event.isSet():
|
||||||
|
self.needsync = True
|
||||||
|
self.event.set()
|
||||||
|
else:
|
||||||
|
# We got an "abort" signal.
|
||||||
|
self.imapaborted = True
|
||||||
|
self.stop()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if self.event.isSet():
|
if self.event.isSet():
|
||||||
return
|
return
|
||||||
self.needsync = False
|
self.needsync = False
|
||||||
self.imapaborted = False
|
self.imapaborted = False
|
||||||
def callback(args):
|
|
||||||
result, cb_arg, exc_data = args
|
|
||||||
if exc_data is None:
|
|
||||||
if not self.event.isSet():
|
|
||||||
self.needsync = True
|
|
||||||
self.event.set()
|
|
||||||
else:
|
|
||||||
# We got an "abort" signal.
|
|
||||||
self.imapaborted = True
|
|
||||||
self.stop()
|
|
||||||
|
|
||||||
success = False # successfully selected FOLDER?
|
success = False # successfully selected FOLDER?
|
||||||
while not success:
|
while not success:
|
||||||
|
Loading…
Reference in New Issue
Block a user