diff options
Diffstat (limited to 'worker')
-rw-r--r-- | worker/imap/cache.go | 14 | ||||
-rw-r--r-- | worker/types/messages.go | 3 |
2 files changed, 6 insertions, 11 deletions
diff --git a/worker/imap/cache.go b/worker/imap/cache.go index 3c807c50..17a622d6 100644 --- a/worker/imap/cache.go +++ b/worker/imap/cache.go @@ -85,7 +85,7 @@ func (w *IMAPWorker) cacheHeader(mi *models.MessageInfo) { func (w *IMAPWorker) getCachedHeaders(msg *types.FetchMessageHeaders) []uint32 { logging.Debugf("Retrieving headers from cache: %v", msg.Uids) - var need, found []uint32 + var need []uint32 uv := fmt.Sprintf("%d", w.selected.UidValidity) for _, uid := range msg.Uids { u := fmt.Sprintf("%d", uid) @@ -118,17 +118,11 @@ func (w *IMAPWorker) getCachedHeaders(msg *types.FetchMessageHeaders) []uint32 { Uid: ch.Uid, RFC822Headers: hdr, } - found = append(found, uid) logging.Debugf("located cached header %s.%s", uv, u) w.worker.PostMessage(&types.MessageInfo{ - Message: types.RespondTo(msg), - Info: mi, - }, nil) - } - if len(found) > 0 { - // Post in a separate goroutine to prevent deadlocking - go w.worker.PostAction(&types.FetchMessageFlags{ - Uids: found, + Message: types.RespondTo(msg), + Info: mi, + NeedsFlags: true, }, nil) } return need diff --git a/worker/types/messages.go b/worker/types/messages.go index acd515f2..9194cbe4 100644 --- a/worker/types/messages.go +++ b/worker/types/messages.go @@ -212,7 +212,8 @@ type SearchResults struct { type MessageInfo struct { Message - Info *models.MessageInfo + Info *models.MessageInfo + NeedsFlags bool } type FullMessage struct { |