MBOX-Line: From imap at maclean.com  Tue Apr 29 16:16:35 2014
To: imap-protocol@u.washington.edu
From: Pete Maclean <imap@maclean.com>
Date: Fri Jun  8 12:34:52 2018
Subject: [Imap-protocol] FETCH order
Message-ID: <mailman.17.1528486492.22076.imap-protocol@mailman13.u.washington.edu>

I am working with a customer that wants some changes made to my IMAP 
server to optimize the FETCHing of batches of full messages (such as 
during mailbox syncs).  Currently the server always returns messages 
in ascending order by UID/MSN irrespective of the order in the FETCH 
command.  In the case of this customer, messages have to be retrieved 
internally from one or more back ends and the time required to do 
this can vary considerably from message to message.  We want to 
pipeline this retrieval so that those messages that can be retrieved 
most quickly are returned to the client first.  The result would be 
that the client would receive the messages in an apparently random order.

It is very clear that this is permitted by IMAP.  It seems in the 
spirit of the protocol and there is some text in the definition of 
"sequence-set" that makes it explicit (although the way it is 
expressed could be much improved).  However this leaves us with one 
concern.  We observe that there exist clients that appear to only 
ever send FETCH commands with sequence sets in ascending order and we 
wonder if any of these would get messed up if they are sent the 
message data in a different order.  Does anyone have any experience with this?

Thanks,

Pete Maclean


