diff options
-rw-r--r-- | internal/imap/mailboxes.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/imap/mailboxes.go b/internal/imap/mailboxes.go index f1dc6c6..25bf087 100644 --- a/internal/imap/mailboxes.go +++ b/internal/imap/mailboxes.go @@ -26,6 +26,14 @@ func (mbs *mailboxes) unlocking(elem Folder) { func (mbs *mailboxes) locking(elem Folder) bool { mbs.mu.Lock() + + // check again, if the folder has been created in the meantime + _, ok := mbs.mb[elem.str] + if ok { + mbs.mu.Unlock() + return true + } + ch, ok := mbs.changeLocks[elem.str] if !ok { ch = make(chan struct{}) |