Pause event loop while FETCHing to prevetn EXPUNGE

This commit is contained in:
Michal Horejsek
2020-07-23 09:09:52 +02:00
parent 9d65192ad7
commit 2269a9edb7
6 changed files with 33 additions and 5 deletions

View File

@ -383,6 +383,12 @@ func (im *imapMailbox) ListMessages(isUID bool, seqSet *imap.SeqSet, items []ima
im.panicHandler.HandlePanic()
}()
// EXPUNGE cannot be sent during listing and can come only from
// the event loop, so we prevent any server side update to avoid
// the problem.
im.storeUser.PauseEventLoop(true)
defer im.storeUser.PauseEventLoop(false)
var markAsReadIDs []string
markAsReadMutex := &sync.Mutex{}