]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Add comment explaining EXPUNGE batching
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 3 Feb 2022 18:59:05 +0000 (19:59 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 22 Feb 2022 09:28:55 +0000 (09:28 +0000)
src/imap/imap-expunge.c

index ff1a2134e857f8a91b9030ebb9b616916013e68f..9a5bafed4fd008087efa0696f297f4d1028e0c16 100644 (file)
@@ -73,6 +73,20 @@ int imap_expunge(struct mailbox *box, struct mail_search_arg *next_search_arg,
                return -1;
        }
 
+       /* NOTE: This batching mainly helps when lazy_expunge is used. Without
+          it, it just quickly writes a bunch of expunge transactions. The
+          actual email deletion is done afterwards in mailbox_sync() for all
+          of the mails. This isn't ideal, but alternatives are a bit tricky
+          because mailbox_sync() can't be called for the SELECTed mailbox.
+
+          a) Simpler fix would be to open a new mailbox view which can be
+          synced, but this causes imapc to open another IMAP connection.
+          Although if it's done only for large expunge transactions it would
+          be less of an issue.
+
+          b) The caller would have to do batching and sync the mailbox
+          multiple times. This would require a new kind of cmd_sync() that
+          would send untagged replies but not the tagged reply. */
        seqset_iter = imap_search_seqset_iter_init(search_args, status.messages,
                                                   IMAP_EXPUNGE_BATCH_SIZE);