Skip to content

Commit 965b63c

Browse files
committed
feat(connections): If EmailEngine is syncing an account then use a secondary IMAP connection to serve API requests
1 parent c3f5ac7 commit 965b63c

File tree

4 files changed

+292
-139
lines changed

4 files changed

+292
-139
lines changed

lib/account.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -395,18 +395,24 @@ class Account {
395395
}
396396

397397
let accountData = this.unserializeAccountData(result);
398-
if (requireValid && accountData.state !== 'connected') {
398+
if (requireValid && !['connected', 'connecting', 'syncing'].includes(accountData.state)) {
399399
let err;
400400
switch (accountData.state) {
401401
case 'init':
402402
err = new Error('Requested account is not yet initialized');
403403
err.code = 'NotYetConnected';
404404
break;
405+
/*
406+
// Check disabled for the following states - allow commands to go through.
407+
// A secondary IMAP connection is opened if possible.
408+
*/
409+
/*
405410
case 'connecting':
406411
case 'syncing':
407412
err = new Error('Requested account is not yet connected');
408413
err.code = 'NotYetConnected';
409414
break;
415+
*/
410416
case 'authenticationError':
411417
err = new Error('Requested account can not be authenticated');
412418
err.code = 'AuthenticationFails';

0 commit comments

Comments
 (0)