From 7a9fe3824f49905f46700a4620cce97fdd32b3eb Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Fri, 7 Aug 2020 09:49:47 +0200 Subject: [PATCH] notmuch: manually close notmuch objects There seems to be some race with the automatic closing that should happen in theory... close it manually where we can to avoid the issue --- worker/notmuch/lib/database.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go index 1b0771c..cdedcb9 100644 --- a/worker/notmuch/lib/database.go +++ b/worker/notmuch/lib/database.go @@ -122,10 +122,12 @@ func (db *DB) MsgIDsFromQuery(q string) ([]string, error) { if err != nil { return err } + defer query.Close() msgs, err := query.Messages() if err != nil { return err } + defer msgs.Close() var msg *notmuch.Message for msgs.Next(&msg) { msgIDs = append(msgIDs, msg.ID()) @@ -189,6 +191,7 @@ func (db *DB) MsgTags(key string) ([]string, error) { } defer msg.Close() ts := msg.Tags() + defer ts.Close() var tag *notmuch.Tag for ts.Next(&tag) { tags = append(tags, tag.Value)