From: Timo Sirainen Date: Thu, 3 Feb 2022 18:59:05 +0000 (+0100) Subject: imap: Add comment explaining EXPUNGE batching X-Git-Tag: 2.4.0~4379 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=12016539558c4bd148e2aea86342bdfe6f66d12f;p=thirdparty%2Fdovecot%2Fcore.git imap: Add comment explaining EXPUNGE batching --- diff --git a/src/imap/imap-expunge.c b/src/imap/imap-expunge.c index ff1a2134e8..9a5bafed4f 100644 --- a/src/imap/imap-expunge.c +++ b/src/imap/imap-expunge.c @@ -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);