Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Mar 5, 2024
1 parent ffcb559 commit 33ef225
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/mailbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1746,6 +1746,12 @@ class Mailbox {
}
fetchCompleted = true;
} catch (err) {
if (!imapClient.usable) {
// nothing to do here, connection closed
this.logger.error({ msg: `FETCH failed, connection already closed, not retrying` });
return;
}

try {
// set failure flag
await this.connection.redis.hSetExists(
Expand All @@ -1766,12 +1772,6 @@ class Mailbox {
}

// retry
if (!imapClient.usable) {
// nothing to do here, connection closed
this.logger.error({ msg: `FETCH failed, connection already closed, not retrying` });
return;
}

let fetchRetryDelay = calculateFetchBackoff(++fetchRetryCount);
this.logger.error({ msg: `FETCH failed, retrying in ${Math.round(fetchRetryDelay / 1000)}s` });
await new Promise(r => setTimeout(r, fetchRetryDelay));
Expand Down

0 comments on commit 33ef225

Please sign in to comment.