owainlewis / clojure-mail

A Clojure library for parsing, downloading and reading email from IMAP servers.
202 stars 54 forks source link

watching imap silently fails upon network disconnection #71

Open michaelmrose opened 4 years ago

michaelmrose commented 4 years ago

Depending upon time disconnected it will either just silently miss events during disconnection and resume working or silently fail to connect but report that it is still functioning.

Is there a way to make it fail as soon as it is no longer connected?

I see https://javaee.github.io/javamail/docs/api/com/sun/mail/imap/package-summary.html

lists

mail.imap.connectiontimeout | int | Socket connection timeout value in milliseconds. This timeout is implemented by java.net.Socket. Default is infinite timeout.

mail.imap.timeout | int | Socket read timeout value in milliseconds. This timeout is implemented by java.net.Socket. Default is infinite timeout.

But either I'm setting them incorrectly or the end result is not as desired. It would be nice if clojure-mail exposed an option to set a timeout and a function to call on timeout.