]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Don't send NOOP immediately after SELECT
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 9 Dec 2016 13:06:05 +0000 (15:06 +0200)
committerGitLab <gitlab@git.dovecot.net>
Fri, 9 Dec 2016 13:33:42 +0000 (15:33 +0200)
NOOP is normally used by mailbox syncing to check if there are any changes
done by other concurrent IMAP sessions. But doing it immediately after
SELECT is unnecessary, because nothing could have changed.

src/lib-storage/index/imapc/imapc-sync.c

index 4d94f9e36fbf441367771a1adf865487f7c43335..1b3f7df25c36b7f6cf1870496c84273c9be12794 100644 (file)
@@ -550,8 +550,11 @@ imapc_noop_if_needed(struct imapc_mailbox *mbox, enum mailbox_sync_flags flags)
        enum imapc_capability capabilities;
 
        capabilities = imapc_client_get_capabilities(mbox->storage->client->client);
-       if ((capabilities & IMAPC_CAPABILITY_IDLE) == 0 ||
-           (flags & MAILBOX_SYNC_FLAG_FULL_READ) != 0) {
+       if (!mbox->initial_sync_done) {
+               /* we just SELECTed/EXAMINEd the mailbox, don't do another
+                  NOOP. */
+       } else if ((capabilities & IMAPC_CAPABILITY_IDLE) == 0 ||
+                  (flags & MAILBOX_SYNC_FLAG_FULL_READ) != 0) {
                /* do NOOP to make sure we have the latest changes before
                   starting sync. this is necessary either because se don't
                   support IDLE at all, or because we want to be sure that we