emersion / go-imap

📥 An IMAP library for clients and servers
MIT License
2.1k stars 297 forks source link

v1: logout call stucks and no return #547

Open c4r3 opened 1 year ago

c4r3 commented 1 year ago

Hi, i created a small client wrapper with the following snippet for the fetching function:

go func() {
        if err := imapClient.Fetch(seqSet, items, messages); err != nil {
            log.Fatal(err)
        }
    }()

It works like a charm. I added also a watchdog goroutine that collects sigint and sigterm event to manage a graceful shutdown feature. When the shutdown goroutine call the logout function on the imapClient it hangs. BTW the "imapClient" is a reference of the singleton IMAP client. Any suggestion? I don't want closing the "messages" channel and manage the corresponding error, it's awful...