folder: IMAP: display error message before starting next try
Fetching messages is tried more than once. Display the error message at correct time. Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
		@@ -736,12 +736,15 @@ class IMAPFolder(BaseFolder):
 | 
				
			|||||||
                        severity = OfflineImapError.ERROR.MESSAGE
 | 
					                        severity = OfflineImapError.ERROR.MESSAGE
 | 
				
			||||||
                        raise OfflineImapError(message,
 | 
					                        raise OfflineImapError(message,
 | 
				
			||||||
                            OfflineImapError.ERROR.MESSAGE)
 | 
					                            OfflineImapError.ERROR.MESSAGE)
 | 
				
			||||||
 | 
					                    self.ui.error("%s. While fetching msg %r in folder %r."
 | 
				
			||||||
 | 
					                        " Query: %s Retrying (%d/%d)"% (
 | 
				
			||||||
 | 
					                            e, uids, self.name, query,
 | 
				
			||||||
 | 
					                            retry_num - fails_left, retry_num
 | 
				
			||||||
 | 
					                            )
 | 
				
			||||||
 | 
					                        )
 | 
				
			||||||
                    # Release dropped connection, and get a new one.
 | 
					                    # Release dropped connection, and get a new one.
 | 
				
			||||||
                    self.imapserver.releaseconnection(imapobj, True)
 | 
					                    self.imapserver.releaseconnection(imapobj, True)
 | 
				
			||||||
                    imapobj = self.imapserver.acquireconnection()
 | 
					                    imapobj = self.imapserver.acquireconnection()
 | 
				
			||||||
                    self.ui.error("%s. While fetching msg %r in folder %r."
 | 
					 | 
				
			||||||
                        " Retrying (%d/%d)"%
 | 
					 | 
				
			||||||
                        (e, uids, self.name, retry_num - fails_left, retry_num))
 | 
					 | 
				
			||||||
        finally:
 | 
					        finally:
 | 
				
			||||||
             # The imapobj here might be different than the one created before
 | 
					             # The imapobj here might be different than the one created before
 | 
				
			||||||
             # the ``try`` clause. So please avoid transforming this to a nice
 | 
					             # the ``try`` clause. So please avoid transforming this to a nice
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -477,7 +477,6 @@ class IMAPServer(object):
 | 
				
			|||||||
            # Try to find one that previously belonged to this thread
 | 
					            # Try to find one that previously belonged to this thread
 | 
				
			||||||
            # as an optimization.  Start from the back since that's where
 | 
					            # as an optimization.  Start from the back since that's where
 | 
				
			||||||
            # they're popped on.
 | 
					            # they're popped on.
 | 
				
			||||||
            imapobj = None
 | 
					 | 
				
			||||||
            for i in range(len(self.availableconnections) - 1, -1, -1):
 | 
					            for i in range(len(self.availableconnections) - 1, -1, -1):
 | 
				
			||||||
                tryobj = self.availableconnections[i]
 | 
					                tryobj = self.availableconnections[i]
 | 
				
			||||||
                if self.lastowner[tryobj] == curThread.ident:
 | 
					                if self.lastowner[tryobj] == curThread.ident:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user