diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-02-21 16:43:39 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-02-21 17:43:31 +0100 |
commit | 1f03f19402266c63bbb7120f50caacf3f6f79a36 (patch) | |
tree | dbdfb686393d7d9a924afca77433c507bf311e83 /internal/imap/mailboxes.go | |
parent | 3e9a26af773f5025e1540f9be5da952c448f1edd (diff) | |
download | feed2imap-go-1f03f19402266c63bbb7120f50caacf3f6f79a36.tar.gz feed2imap-go-1f03f19402266c63bbb7120f50caacf3f6f79a36.tar.bz2 feed2imap-go-1f03f19402266c63bbb7120f50caacf3f6f79a36.zip |
#25 Check for folder again while locking
Diffstat (limited to '')
-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{}) |