Closed serhiynovos closed 2 months ago
Since ca0ddb75a697f13e66376b7f7be82cd13efdd507, IdleCommand.Wait
can be called before Close
. It should now be possible to use it to figure out when the connection is broken.
@emersion Should we also include timeout adjustability regardless, as they won't be able to act on that new information without it?
A connection can be closed by the server for many reasons, e.g. the server is restarted, or connectivity is lost for a moment.
@emersion is there any way to handle it ?
In your code snippet, you can add something like
if err := idleCmd.Wait(); err != nil {
log.Fatalf("IDLE command failed: %v", err)
}
maybe in a goroutine since you're already blocking with <-client.ctx.Done()
.
I need a service to listening for incoming emails and send them to internal server. It's working but I noticed that in some time like 1 2 days it stops receiving a new emails. In console I don't see any errors. Is there are any way I can check idle client status and if it's failed I can restart client or even just fail client so container with it will be restarted automatically ?