From 31488503aa0edf0962a9d90f5a093d346ea29f06 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Wed, 30 Aug 2023 16:17:55 -0500 Subject: notmuch: check context when opening directory Check for a canceled context when opening a directory with notmuch. The OpenDirectory message carries a context tied to the directory lister - checking for the context error can prevent us from opening a directory that has already been deselected (even after the dirlist-delay period) Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- worker/notmuch/worker.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'worker/notmuch/worker.go') diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go index 51de6ccb..13733d60 100644 --- a/worker/notmuch/worker.go +++ b/worker/notmuch/worker.go @@ -312,6 +312,9 @@ func (w *worker) getDirectoryInfo(name string, query string) *models.DirectoryIn } func (w *worker) handleOpenDirectory(msg *types.OpenDirectory) error { + if msg.Context.Err() != nil { + return context.Canceled + } w.w.Tracef("opening %s", msg.Directory) var isDynamicFolder bool -- cgit