From 47390e03d6a07b2ab73b65b74b668b7ce0663f57 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Fri, 20 Jan 2012 14:39:53 +0100 Subject: [PATCH] Don't CHECK imapserver after each APPEND Most servers support the UIDPLUS extension, and we don't have to search headers after each uploaded message. There is no need to CHECK the imap server after each message when there is no need to search headers. I have not measured the performance impact on real world servers, but this lets us do less unneeded work in the common case. Signed-off-by: Sebastian Spaeth --- Changelog.draft.rst | 3 +++ offlineimap/folder/IMAP.py | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Changelog.draft.rst b/Changelog.draft.rst index cfbd1b9..679ccef 100644 --- a/Changelog.draft.rst +++ b/Changelog.draft.rst @@ -19,6 +19,9 @@ New Features Changes ------- +* Slight performance enhancement uploading mails to an IMAP server in the + common case. + Bug Fixes --------- diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index 6f4cf92..3dbcaa8 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -567,10 +567,6 @@ class IMAPFolder(BaseFolder): "failed (error). Server reponded: %s\nMessage content was: " "%s" % (self, self.getrepository(), str(e), dbg_output), OfflineImapError.ERROR.MESSAGE) - # Checkpoint. Let it write out stuff, etc. Eg searches for - # just uploaded messages won't work if we don't do this. - typ, dat = imapobj.check() - assert(typ == 'OK') # get the new UID, default to 0 (=unknown) uid = 0 @@ -587,6 +583,11 @@ class IMAPFolder(BaseFolder): else: # Don't support UIDPLUS + # Checkpoint. Let it write out stuff, etc. Eg searches for + # just uploaded messages won't work if we don't do this. + typ, dat = imapobj.check() + assert(typ == 'OK') + uid = self.savemessage_searchforheader(imapobj, headername, headervalue) # If everything failed up to here, search the message