accounts: remove duplicated code paths

Currently, account.syncrunner() has 2 separate duplicated code paths
depending on whether we want to autorefresh after some waiting perios
or not. Unify those code paths by setting "looping = False" in case
self.refeshperiod == 0 after the first run. Behavior is identical to
before.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Sebastian Spaeth 2011-05-04 16:45:26 +02:00 committed by Nicolas Sebrecht
parent f3249e0856
commit 3446b592f3

View File

@ -202,22 +202,9 @@ class SyncableAccount(Account):
self.localrepos = Repository(self, 'local') self.localrepos = Repository(self, 'local')
self.statusrepos = Repository(self, 'status') self.statusrepos = Repository(self, 'status')
#might need changes here to ensure that one account sync does not crash others... # Might need changes here to ensure that one account sync does
if not self.refreshperiod: # not crash others...
try: # Loop account synchronization if needed
try:
self.sync(siglistener)
except (KeyboardInterrupt, SystemExit):
raise
except:
self.ui.warn("Error occured attempting to sync account " + self.name \
+ ": " + traceback.format_exc())
finally:
self.ui.acctdone(self.name)
return
looping = 1 looping = 1
while looping: while looping:
try: try:
@ -229,7 +216,7 @@ class SyncableAccount(Account):
self.ui.warn("Error occured attempting to sync account " + self.name \ self.ui.warn("Error occured attempting to sync account " + self.name \
+ ": " + traceback.format_exc()) + ": " + traceback.format_exc())
finally: finally:
looping = self.sleeper(siglistener) != 2 looping = self.refreshperiod and self.sleeper(siglistener) != 2
self.ui.acctdone(self.name) self.ui.acctdone(self.name)