mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-11-16 22:51:11 +01:00
When fetching message headers in a large folder, aerc could enter an infinite loop, repeatedly fetching the same message metadata. This was caused by a bug in the JMAP worker's message fetching logic. The `handleFetchMessageHeaders` function in `worker/jmap/fetch.go` iterates over a slice of emails (`currentEmails`) to identify threads that need to be fetched. If a thread was already cached, the code would then iterate over all emails within that thread and append them to the `currentEmails` slice. Appending to a slice while iterating over it is a classic Go pitfall that can lead to unexpected behavior. In this case, it caused the loop to re-process the same emails repeatedly, leading to an infinite loop of `Email/get` requests for the same message ID. This patch fixes the bug by removing the line that appends to the `currentEmails` slice inside the loop. The UI is still updated with the information about the emails in the cached thread, but the main loop does not grow and the infinite loop is avoided. Signed-off-by: Matěj Cepl <mcepl@cepl.eu> Tested-by: Tristan Partin <tristan@partin.io> Reviewed-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc> |
||
|---|---|---|
| .. | ||
| cache | ||
| configure.go | ||
| connect.go | ||
| directories.go | ||
| fetch.go | ||
| jmap.go | ||
| push.go | ||
| search.go | ||
| send.go | ||
| set.go | ||
| threads.go | ||
| worker.go | ||