aboutsummaryrefslogtreecommitdiffstats
path: root/worker/imap
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2024-02-26 21:51:27 +0100
committerRobin Jarry <robin@jarry.cc>2024-02-26 23:29:40 +0100
commit66bbc5303578b70e7dd3ef095b3bf43273181f87 (patch)
tree47d6052ac381860ad88ac8d003d05f8df1150655 /worker/imap
parent8543aec8f12c59f914807a40f004a0360c2cb610 (diff)
downloadaerc-66bbc5303578b70e7dd3ef095b3bf43273181f87.tar.gz
imap: drain updates channel when moving messages
Drain the updates channel when moving messages to prevent a backend freeze. This also fixes a possible freeze for large-scale archive operations since the archive command uses the move operation. Reported-by: Moritz Poldrack <moritz@poldrack.dev> Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Jeremy Baxter <jtbx@disroot.org> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/imap')
-rw-r--r--worker/imap/movecopy.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/worker/imap/movecopy.go b/worker/imap/movecopy.go
index d3df133a..58357a45 100644
--- a/worker/imap/movecopy.go
+++ b/worker/imap/movecopy.go
@@ -48,6 +48,9 @@ func (imapw *IMAPWorker) handleAppendMessage(msg *types.AppendMessage) {
}
func (imapw *IMAPWorker) handleMoveMessages(msg *types.MoveMessages) {
+ drain := imapw.drainUpdates()
+ defer drain.Close()
+
uids := toSeqSet(msg.Uids)
if err := imapw.client.UidMove(uids, msg.Destination); err != nil {
imapw.worker.PostMessage(&types.Error{