[client-sync] Fix mail listener imap connection

Summary:
Given that we keep the imap mail listener conenction open outside of the
imap connection pool, it might close itself after a while or after
putting your computer to sleep.

Previously, if we had the connection object we just assumed it was
connected and proceeded with sync, and if it wasn't, we would fall into
an error loop in the sync worker preventing it from syncing at all (T8065)

To fix this, we just call `connect` every time to ensure the connection is open.
(This was the case before we introduced the connection pool)

Test Plan: manual

Reviewers: mark, spang, halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D4334
This commit is contained in:
Juan Tejada 2017-04-04 11:52:56 -07:00
parent f629818075
commit 7dec807b28

View file

@ -252,7 +252,8 @@ class SyncWorker {
async _ensureIMAPMailListenerConnection() {
if (this._destroyed) { return }
if (this._mailListenerConn) {
return;
await this._mailListenerConn.connect();
return
}
await IMAPConnectionPool.withConnectionsForAccount(this._account, {