aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2023-06-20 11:07:08 -0500
committerRobin Jarry <robin@jarry.cc>2023-06-20 23:16:25 +0200
commit0662bca73efab7919031d4a89acb1f525c3d8466 (patch)
tree23d30627129c37e56289dc361123e8b48954606d
parent115fb9322ce4065bb7212e8979464d0f9c1db12d (diff)
downloadaerc-0662bca73efab7919031d4a89acb1f525c3d8466.tar.gz
msgstore: delete pending headers when done or cancelled
The msgstore keeps a map of UIDs it has requested headers for. The map is only cleared of pending headers when either an error or a valid header is received. This can lead to pending headers not being removed from the list (and therefore never re-requested) if a user has navigated away from the directory before the response is received. Delete the pending headers list if the request is finished or cancelled. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--lib/msgstore.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 77aeb4c1..376e079e 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -144,7 +144,8 @@ func (store *MessageStore) FetchHeaders(uids []uint32,
Uids: toFetch,
},
func(msg types.WorkerMessage) {
- if _, ok := msg.(*types.Error); ok {
+ switch msg.(type) {
+ case *types.Error, *types.Done, *types.Cancelled:
for _, uid := range toFetch {
delete(store.pendingHeaders, uid)
}