From 3446b592f3886100a41f283ca6103a32a5111caf Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Wed, 4 May 2011 16:45:26 +0200 Subject: [PATCH] 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 Signed-off-by: Nicolas Sebrecht --- offlineimap/accounts.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py index 0b71377..f55a18d 100644 --- a/offlineimap/accounts.py +++ b/offlineimap/accounts.py @@ -202,22 +202,9 @@ class SyncableAccount(Account): self.localrepos = Repository(self, 'local') self.statusrepos = Repository(self, 'status') - #might need changes here to ensure that one account sync does not crash others... - if not self.refreshperiod: - try: - 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 - - + # Might need changes here to ensure that one account sync does + # not crash others... + # Loop account synchronization if needed looping = 1 while looping: try: @@ -229,7 +216,7 @@ class SyncableAccount(Account): self.ui.warn("Error occured attempting to sync account " + self.name \ + ": " + traceback.format_exc()) finally: - looping = self.sleeper(siglistener) != 2 + looping = self.refreshperiod and self.sleeper(siglistener) != 2 self.ui.acctdone(self.name)