From 78dd043057af9ccf82d1d7ea1f316f2d55b769c2 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Sat, 15 Feb 2020 14:14:47 +0100 Subject: notmuch: refresh dirlist in background --- worker/notmuch/worker.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'worker/notmuch/worker.go') 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 } -- cgit v1.2.3