summaryrefslogtreecommitdiff
path: root/worker/notmuch/worker.go
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-02-15 14:14:47 +0100
committerDrew DeVault <sir@cmpwn.com>2020-02-16 10:41:19 -0500
commit78dd043057af9ccf82d1d7ea1f316f2d55b769c2 (patch)
treed745dd8e30d399a7fed1757d35cec4dfed0ea140 /worker/notmuch/worker.go
parent8d216ab10e6d43c44ca47ccd44fe7f3d40f1b1c3 (diff)
downloadaerc-78dd043057af9ccf82d1d7ea1f316f2d55b769c2.zip
notmuch: refresh dirlist in background
Diffstat (limited to 'worker/notmuch/worker.go')
-rw-r--r--worker/notmuch/worker.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index 7480124..dfcfa77 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"strings"
+ "time"
"git.sr.ht/~sircmpwn/aerc/config"
"git.sr.ht/~sircmpwn/aerc/lib/uidstore"
@@ -26,6 +27,8 @@ func init() {
var errUnsupported = fmt.Errorf("unsupported command")
+const backgroundRefreshDelay = 1 * time.Minute
+
type worker struct {
w *types.Worker
nmEvents chan eventType
@@ -168,6 +171,12 @@ func (w *worker) handleConnect(msg *types.Connect) error {
}
w.done(msg)
w.emitLabelList()
+ go func() {
+ for {
+ w.nmEvents <- &updateDirCounts{}
+ time.Sleep(backgroundRefreshDelay)
+ }
+ }()
return nil
}