mail-time
Advanced tools
Comparing version 0.1.3 to 0.1.4
35
index.js
@@ -1,4 +0,6 @@ | ||
var JoSk = require('josk'); | ||
var NoOp = function noop() {}; | ||
var merge = require('deepmerge'); | ||
var JoSk = require('josk'); | ||
var NoOp = function noop() {}; | ||
var merge = require('deepmerge'); | ||
var _debug = console.info; | ||
var _log = console.error; | ||
@@ -95,7 +97,12 @@ var equals; | ||
this.template = (typeof opts.template === 'string') ? opts.template : '{{{html}}}'; | ||
this.zombieTime = opts.zombieTime || 32786; | ||
if (this.interval < 2048) { | ||
this.interval = 3072; | ||
if (this.interval < 2048 || isNaN(this.interval)) { | ||
this.interval = 3072; | ||
} | ||
if (this.zombieTime < 8192 || isNaN(this.zombieTime)) { | ||
this.zombieTime = 8192; | ||
} | ||
this.strategy = (opts.strategy === 'backup' || opts.strategy === 'balancer') ? opts.strategy : 'backup'; | ||
@@ -146,3 +153,3 @@ this.failsToNext = (opts.failsToNext && !isNaN(opts.failsToNext)) ? parseInt(opts.failsToNext) : 4; | ||
resetOnInit: false, | ||
zombieTime: 8192 | ||
zombieTime: this.zombieTime | ||
}); | ||
@@ -271,3 +278,3 @@ | ||
if (self.debug === true) { | ||
console.info('[mail-time] Send attempt #' + (task.tries) + ', transport #' + transportIndex + ', to: ', task.mailOptions[0].to, 'from: ', _mailOpts.from); | ||
_debug('[mail-time] Send attempt #' + (task.tries) + ', transport #' + transportIndex + ', to: ', task.mailOptions[0].to, 'from: ', _mailOpts.from); | ||
} | ||
@@ -285,3 +292,3 @@ | ||
if (self.debug === true) { | ||
console.info('[mail-time] email successfully sent, attempts: #' + (task.tries) + ', transport #' + transportIndex + ' to: ', _mailOpts.to); | ||
_debug('[mail-time] email successfully sent, attempts: #' + (task.tries) + ', transport #' + transportIndex + ' to: ', _mailOpts.to); | ||
} | ||
@@ -302,3 +309,3 @@ | ||
if (self.debug === true) { | ||
console.error('[mail-time] Exception during runtime:', e); | ||
_log('[mail-time] Exception during runtime:', e); | ||
} | ||
@@ -385,3 +392,3 @@ self.___handleError(task, e); | ||
if (self.debug === true) { | ||
console.error('[mail-time] something went wrong, can\'t send email to: ', opts.mailOptions[0].to, findError); | ||
_log('[mail-time] something went wrong, can\'t send email to: ', opts.mailOptions[0].to, findError); | ||
} | ||
@@ -412,3 +419,3 @@ callback(findError, void 0, task); | ||
if (self.debug === true) { | ||
console.error('[mail-time] something went wrong, can\'t send email to: ', task.mailOptions[0].to, updateError); | ||
_log('[mail-time] something went wrong, can\'t send email to: ', task.mailOptions[0].to, updateError); | ||
} | ||
@@ -463,3 +470,3 @@ callback(updateError, void 0, task); | ||
if (self.debug === true) { | ||
console.error('[mail-time] Giving up trying send email after ' + (task.tries) + ' attempts to: ', task.mailOptions[0].to, error); | ||
_log('[mail-time] Giving up trying send email after ' + (task.tries) + ' attempts to: ', task.mailOptions[0].to, error); | ||
} | ||
@@ -495,3 +502,3 @@ | ||
if (this.debug === true) { | ||
console.warn('[mail-time] Re-send Attempt #' + (task.tries) + ', transport #' + transportIndex + ' to: ', task.mailOptions[0].to, error); | ||
_debug('[mail-time] Re-send Attempt #' + (task.tries) + ', transport #' + transportIndex + ' to: ', task.mailOptions[0].to, error); | ||
} | ||
@@ -529,3 +536,3 @@ } | ||
if (self.debug === true) { | ||
console.error('[mail-time] something went wrong, can\'t send email to: ', opts.mailOptions[0].to, insertError); | ||
_log('[mail-time] something went wrong, can\'t send email to: ', opts.mailOptions[0].to, insertError); | ||
} | ||
@@ -532,0 +539,0 @@ callback(insertError, void 0, opts); |
{ | ||
"name": "mail-time", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Bulletproof email queue on top of NodeMailer with support of multiple clusters and servers setup", | ||
@@ -29,6 +29,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"deepmerge": "^1.3.2", | ||
"deepmerge": "^1.4.4", | ||
"josk": "^1.0.3", | ||
"mongodb": "^2.2.28" | ||
"mongodb": "^2.2.29" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
38440
509
Updateddeepmerge@^1.4.4
Updatedmongodb@^2.2.29