From 7dec807b289d743b4f19e8b95aabef719f164039 Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Tue, 4 Apr 2017 11:52:56 -0700 Subject: [PATCH] [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 --- packages/client-sync/src/local-sync-worker/sync-worker.es6 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/client-sync/src/local-sync-worker/sync-worker.es6 b/packages/client-sync/src/local-sync-worker/sync-worker.es6 index 04ca2b570..a9385ebd8 100644 --- a/packages/client-sync/src/local-sync-worker/sync-worker.es6 +++ b/packages/client-sync/src/local-sync-worker/sync-worker.es6 @@ -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, {