jcreigno/nodejs-mail-notifier

Multiple connection after error or end

Closed this issue · 1 comments

After losing a connection (catching 'end' event) I try to reconnect in 30 seconds.
Then the connection established, I get not one but two, three or more connections to imap server.
This happens because of not disconnecting imap after 'end' or 'error'.
I try to stop before each start of notifier but it not works, because notifier checks self.connected, so I removed this check from Notifier.prototype.stop and all works fine for me.
Can you fix this, or give an example how to reconnect to server after losing or some another ending of connection.

Indeed, there was a bug when restarting that caused to be notified twice (or more).
This is fix in 8f439e1