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 <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-01-20 14:39:53 +01:00
parent 4d47f7bf3c
commit 47390e03d6
2 changed files with 8 additions and 4 deletions

View File

@ -19,6 +19,9 @@ New Features
Changes
-------
* Slight performance enhancement uploading mails to an IMAP server in the
common case.
Bug Fixes
---------

View File

@ -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