emersion / go-imap

📥 An IMAP library for clients and servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v1: logout call stucks and no return

c4r3 opened this issue · comments

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...