From 0662bca73efab7919031d4a89acb1f525c3d8466 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Tue, 20 Jun 2023 11:07:08 -0500 Subject: 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 Tested-by: Bence Ferdinandy Acked-by: Robin Jarry --- lib/msgstore.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/msgstore.go') 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) } -- cgit