aboutsummaryrefslogtreecommitdiffstats
path: root/worker/maildir/worker.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-11-07 13:40:05 -0600
committerRobin Jarry <robin@jarry.cc>2022-11-09 21:38:43 +0100
commit650e00972d036014530594bbd781579166889a5e (patch)
tree2f4984c5fcfcf34b71265c4f3db9270d89dd9288 /worker/maildir/worker.go
parente918b99fc3e688de9a639c5905cf6a28d0f395eb (diff)
downloadaerc-650e00972d036014530594bbd781579166889a5e.tar.gz
maildir: drain limit channel on parse error when sorting
Commit 155f0c3f28a1 ("maildir/sort: get MessageInfos in parallel") added parallel parsing of maildir messages. The parsing is limitted to 2x the number of CPUs using a buffered channel. The channel is drained at the end of the parsing, however it is not drained if a parse error is encountered. With enough errors, this can lead to a deadlock. Drain the channel when an error occurs. Fixes: 155f0c3f28a1 ("maildir/sort: get MessageInfos in parallel") Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/maildir/worker.go')
-rw-r--r--worker/maildir/worker.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index d6c05ff0..2cf7897a 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -461,6 +461,7 @@ func (w *Worker) sort(uids []uint32, criteria []*types.SortCriterion) ([]uint32,
info, err := w.msgHeadersFromUid(uid)
if err != nil {
logging.Errorf("could not get message info: %v", err)
+ <-limit
return
}
mu.Lock()