go-imap icon indicating copy to clipboard operation
go-imap copied to clipboard

Add Mailbox.Close

Open foxcpp opened this issue 4 years ago • 2 comments

I am working on the maildir-based backend that uses BoltDB for caches and metadata. BoltDB DB is created per mailbox. backend.Mailbox implementation opens it on demand, but it also needs to close it at some point. Currently Close() is missing for Mailbox so I cannot do it.

Proposal: If Mailbox implements io.Closer, call Close() after use. Not sure about ListMailboxes.

foxcpp avatar Feb 27 '20 11:02 foxcpp

Since BoltDB only supports one consumer at a time, you'll want to refcount mailboxes.

Maybe go-imap v2 should make ListMailboxes return a []MailboxInfo instead of a []Mailbox.

emersion avatar Mar 04 '20 11:03 emersion

For v1 I think Close should be called for mailboxes returned by ListMailboxes too.

foxcpp avatar Mar 04 '20 16:03 foxcpp

Fixed in go-imap v2.

emersion avatar Apr 04 '23 14:04 emersion