Skip to content

Commit

Permalink
fix exception handling for last ip
Browse files Browse the repository at this point in the history
  • Loading branch information
f-w committed Apr 11, 2021
1 parent 3c4a459 commit 4adc331
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "notify-bc",
"version": "2.6.1",
"version": "2.6.2",
"dbSchemaVersion": "0.8.0",
"description": "A versatile notification API server",
"keywords": [
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/base.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class BaseController {
throw ex;
}
// do client retry if there are multiple addresses
for (const address of addresses) {
for (const [index, address] of addresses.entries()) {
const newSmtpCfg = Object.assign({}, smtpCfg, {host: address.address});
const newTransporter = this.nodemailer.createTransport(newSmtpCfg);
try {
Expand All @@ -146,6 +146,7 @@ export class BaseController {
}
} catch (newEx) {
if (
index < addresses.length - 1 &&
newEx.command === 'CONN' &&
['ECONNECTION', 'ETIMEDOUT'].indexOf(newEx.code) >= 0
) {
Expand Down

0 comments on commit 4adc331

Please sign in to comment.