diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-23 23:47:05 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-23 23:47:05 +0200 |
commit | 6911562cf4214531343b7509afe77e38b28a0801 (patch) | |
tree | 46601b14d15b781c373a99f32880334b10092c68 /internal/imap/connection.go | |
parent | c1fbae6e0f5981d4d60f5b614d5d195ae5cde4a8 (diff) | |
download | feed2imap-go-6911562cf4214531343b7509afe77e38b28a0801.tar.gz feed2imap-go-6911562cf4214531343b7509afe77e38b28a0801.tar.bz2 feed2imap-go-6911562cf4214531343b7509afe77e38b28a0801.zip |
Fix concurrent access to the same folder
Diffstat (limited to 'internal/imap/connection.go')
-rw-r--r-- | internal/imap/connection.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/imap/connection.go b/internal/imap/connection.go index 88b1496..358445b 100644 --- a/internal/imap/connection.go +++ b/internal/imap/connection.go @@ -99,6 +99,13 @@ func (conn *connection) ensureFolder(folder Folder) error { return nil } + if conn.mailboxes.locking(folder) { + // someone else tried to create the MB -- try again, now that he's done + return conn.ensureFolder(folder) + } else { + defer conn.mailboxes.unlocking(folder) + } + log.Printf("Checking for folder '%s'", folder) mbox, found, err := conn.list(folder.str) |