v1.11.0
This commit is contained in:
parent
3fa0e109af
commit
9bd6db2624
13 changed files with 201 additions and 51 deletions
|
@ -72,7 +72,24 @@ module.exports.sendMail = (mail, template, callback) => {
|
|||
});
|
||||
}
|
||||
|
||||
module.exports.transport.sendMail(mail, callback);
|
||||
let tryCount = 0;
|
||||
let trySend = () => {
|
||||
tryCount++;
|
||||
|
||||
module.exports.transport.sendMail(mail, (err, info) => {
|
||||
if (err) {
|
||||
log.error('Mail', err.stack);
|
||||
if (err.responseCode && err.responseCode >= 400 && err.responseCode < 500 && tryCount <= 5) {
|
||||
// temporary error, try again
|
||||
log.verbose('Mail', 'Retrying after %s sec. ...', tryCount);
|
||||
return setTimeout(trySend, tryCount * 1000);
|
||||
}
|
||||
return callback(err);
|
||||
}
|
||||
return callback(null, info);
|
||||
});
|
||||
};
|
||||
setImmediate(trySend);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue