summaryrefslogtreecommitdiff
path: root/worker/notmuch/lib/database.go
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-08-07 09:49:47 +0200
committerReto Brunner <reto@labrat.space>2020-08-07 09:49:57 +0200
commit7a9fe3824f49905f46700a4620cce97fdd32b3eb (patch)
tree82aa51b8765d78912435a29f4d5a31d68c1b6803 /worker/notmuch/lib/database.go
parent1023dd95883a3af8f86492a081b48f30ba000755 (diff)
downloadaerc-7a9fe3824f49905f46700a4620cce97fdd32b3eb.zip
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
Diffstat (limited to 'worker/notmuch/lib/database.go')
-rw-r--r--worker/notmuch/lib/database.go3
1 files changed, 3 insertions, 0 deletions
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)