Skip to content

Commit

Permalink
feat(connections): If EmailEngine is syncing an account then use a se…
Browse files Browse the repository at this point in the history
…condary IMAP connection to serve API requests
  • Loading branch information
andris9 committed Feb 20, 2024
1 parent c3f5ac7 commit 965b63c
Show file tree
Hide file tree
Showing 4 changed files with 292 additions and 139 deletions.
8 changes: 7 additions & 1 deletion lib/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,18 +395,24 @@ class Account {
}

let accountData = this.unserializeAccountData(result);
if (requireValid && accountData.state !== 'connected') {
if (requireValid && !['connected', 'connecting', 'syncing'].includes(accountData.state)) {
let err;
switch (accountData.state) {
case 'init':
err = new Error('Requested account is not yet initialized');
err.code = 'NotYetConnected';
break;
/*
// Check disabled for the following states - allow commands to go through.
// A secondary IMAP connection is opened if possible.
*/
/*
case 'connecting':
case 'syncing':
err = new Error('Requested account is not yet connected');
err.code = 'NotYetConnected';
break;
*/
case 'authenticationError':
err = new Error('Requested account can not be authenticated');
err.code = 'AuthenticationFails';
Expand Down
Loading

0 comments on commit 965b63c

Please sign in to comment.