diff --git a/worker/notmuch/eventhandlers.go b/worker/notmuch/eventhandlers.go index 4eec1f6..7b3c517 100644 --- a/worker/notmuch/eventhandlers.go +++ b/worker/notmuch/eventhandlers.go @@ -16,7 +16,7 @@ func (w *worker) handleNotmuchEvent(et eventType) error { func (w *worker) handleUpdateDirCounts(ev eventType) error { for name, query := range w.nameQueryMap { - info, err := w.gatherDirectoryInfo(name, query) + info, err := w.buildDirInfo(name, query, true) if err != nil { logging.Errorf("could not gather DirectoryInfo: %v", err) continue diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go index 6941809..28029b2 100644 --- a/worker/notmuch/worker.go +++ b/worker/notmuch/worker.go @@ -211,12 +211,18 @@ func (w *worker) handleListDirectories(msg *types.ListDirectories) error { } func (w *worker) gatherDirectoryInfo(name string, query string) ( + *types.DirectoryInfo, error) { + return w.buildDirInfo(name, query, false) +} + +func (w *worker) buildDirInfo(name string, query string, skipSort bool) ( *types.DirectoryInfo, error) { count, err := w.db.QueryCountMessages(query) if err != nil { return nil, err } info := &types.DirectoryInfo{ + SkipSort: skipSort, Info: &models.DirectoryInfo{ Name: name, Flags: []string{},