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
				
			@@ -23,6 +23,9 @@ Changes
 | 
				
			|||||||
Bug Fixes
 | 
					Bug Fixes
 | 
				
			||||||
---------
 | 
					---------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Drop connection if synchronisation failed. This is needed if resuming the
 | 
				
			||||||
 | 
					  system from suspend mode gives a wrong connection.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Pending for the next major release
 | 
					Pending for the next major release
 | 
				
			||||||
==================================
 | 
					==================================
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -268,7 +268,14 @@ class SyncableAccount(Account):
 | 
				
			|||||||
            mbnames.write()
 | 
					            mbnames.write()
 | 
				
			||||||
            localrepos.forgetfolders()
 | 
					            localrepos.forgetfolders()
 | 
				
			||||||
            remoterepos.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()
 | 
					            localrepos.holdordropconnections()
 | 
				
			||||||
            remoterepos.holdordropconnections()
 | 
					            remoterepos.holdordropconnections()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user