amqplib-retry
Advanced tools
Comparing version
@@ -8,3 +8,3 @@ 'use strict'; | ||
// must be a string in milliseconds | ||
function getDefaultDelay(attempts) { | ||
function getDefaultDelay (attempts) { | ||
var delay = Math.pow(2, attempts); | ||
@@ -20,3 +20,3 @@ if (delay > 60 * 60 * 24) { | ||
function errorHandler(msg) { | ||
function errorHandler (msg) { | ||
@@ -60,3 +60,3 @@ if (!initializer.isInitialized) { | ||
function handlerWrapper(msg) { | ||
function handlerWrapper (msg) { | ||
return BPromise.resolve(msg) | ||
@@ -67,3 +67,3 @@ .then(clientHandler) | ||
// Adding the string 'error' to support papertrail error filters. | ||
console.error('Error: ', err); | ||
console.error('Error: AMQP retry handler caught the following error: ', err); | ||
return BPromise.resolve(msg) | ||
@@ -70,0 +70,0 @@ .then(errorHandler) |
{ | ||
"name": "amqplib-retry", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Retry failed attempts to consume a message, with increasing delays between each attempt.", | ||
@@ -23,6 +23,2 @@ "author": "Lanetix <engineering@lanetix.com> (https://github.com/lanetix/)", | ||
"main": "./lib/index.js", | ||
"engines": { | ||
"node": ">=0.10", | ||
"npm": "^2" | ||
}, | ||
"scripts": { | ||
@@ -38,3 +34,3 @@ "lint": "eslint --ignore-path .gitignore .", | ||
"devDependencies": { | ||
"eslint": "^0.15", | ||
"eslint": "^0.24", | ||
"eslint-plugin-nodeca": "^1", | ||
@@ -41,0 +37,0 @@ "mocha": "^1", |
@@ -20,3 +20,3 @@ 'use strict'; | ||
function hardcodedDelay(delay) { | ||
function hardcodedDelay (delay) { | ||
return function () { | ||
@@ -27,3 +27,3 @@ return delay; | ||
function checkQueues() { | ||
function checkQueues () { | ||
return BPromise.all([ | ||
@@ -37,3 +37,3 @@ channel.checkQueue(ENTRY_QUEUE_NAME), | ||
function startListenerAndPushMessage(handler, delayFunction) { | ||
function startListenerAndPushMessage (handler, delayFunction) { | ||
return BPromise.resolve() | ||
@@ -104,3 +104,3 @@ .then(function () { | ||
it('acks a successfully handled message', function () { | ||
function success() { | ||
function success () { | ||
} | ||
@@ -120,3 +120,3 @@ | ||
it('acks a successfully handled message (delayed BPromise)', function () { | ||
function delayedSuccess() { | ||
function delayedSuccess () { | ||
return BPromise.resolve() | ||
@@ -141,3 +141,3 @@ .delay(250) | ||
it('a delay of -1 should send the message to the FAIL queue', function () { | ||
function fail() { | ||
function fail () { | ||
throw new Error('example error'); | ||
@@ -158,3 +158,3 @@ } | ||
it('FAIL delivery works for delayed BPromise handlers', function () { | ||
function delayedFail() { | ||
function delayedFail () { | ||
return BPromise.resolve() | ||
@@ -161,0 +161,0 @@ .delay(200) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18340
-9.9%17
-5.56%