Drop all connections when a sync failed
in accounts.sync() we would holdordropconnections() after each sync. But depending on the repository configuration that might imply that offlineimap tries to keep the same connections. But when a sync failed, e.g. after a user had his computer suspended, it might be that our connections that we have are worthless. So definitely drop them after a failed sync. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:

committed by
Nicolas Sebrecht

parent
0bc1c9583e
commit
163f1eefc4
@ -268,7 +268,14 @@ class SyncableAccount(Account):
|
||||
mbnames.write()
|
||||
localrepos.forgetfolders()
|
||||
remoterepos.forgetfolders()
|
||||
finally:
|
||||
except:
|
||||
#error while syncing. Drop all connections that we have, they
|
||||
#might be bogus by now (e.g. after suspend)
|
||||
localrepos.dropconnections()
|
||||
remoterepos.dropconnections()
|
||||
raise
|
||||
else:
|
||||
# sync went fine. Hold or drop depending on config
|
||||
localrepos.holdordropconnections()
|
||||
remoterepos.holdordropconnections()
|
||||
|
||||
|
Reference in New Issue
Block a user