long-task-queue-reader
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -52,3 +52,3 @@ (function() { | ||
return this.client.deleteMessageAsync(this.queueName, messageId, popReceipt).tap(function() { | ||
return "Removed messageId: " + messageId; | ||
return debug("Removed messageId: " + messageId); | ||
}); | ||
@@ -55,0 +55,0 @@ }; |
(function() { | ||
var EventEmitter, LongTaskQueueReader, Promise, _, convert, eventsToLog, winston, | ||
var EventEmitter, KeepAliveMessage, LongTaskQueueReader, Promise, _, convert, eventsToLog, winston, | ||
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | ||
@@ -17,2 +17,4 @@ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
KeepAliveMessage = require("./keepAliveMessage"); | ||
eventsToLog = function(logger) { | ||
@@ -55,5 +57,5 @@ return { | ||
this.runner = runner; | ||
this._timeToTouch = bind(this._timeToTouch, this); | ||
this._touch = bind(this._touch, this); | ||
this._removeSafety = bind(this._removeSafety, this); | ||
this._createKeepAlive = bind(this._createKeepAlive, this); | ||
this._execute = bind(this._execute, this); | ||
@@ -121,9 +123,6 @@ this._nextTimeout = bind(this._nextTimeout, this); | ||
LongTaskQueueReader.prototype._execute = function(message) { | ||
var intervalHandler; | ||
intervalHandler = setInterval(((function(_this) { | ||
return function() { | ||
return _this._touch(message); | ||
}; | ||
})(this)), this._timeToTouch()); | ||
var keepAliveMessage; | ||
keepAliveMessage = this._createKeepAlive(message); | ||
this.emit("synchronization_start", message); | ||
keepAliveMessage.start(); | ||
return new this.MessageExecutor(this.runner, message).execute().tap((function(_this) { | ||
@@ -141,3 +140,3 @@ return function() { | ||
})(this)).tap(function() { | ||
return clearInterval(intervalHandler); | ||
return keepAliveMessage.destroy(); | ||
}).then((function(_this) { | ||
@@ -150,2 +149,6 @@ return function() { | ||
LongTaskQueueReader.prototype._createKeepAlive = function(message) { | ||
return new KeepAliveMessage(message, this.visibilityTimeout, this._touch); | ||
}; | ||
LongTaskQueueReader.prototype._removeSafety = function(message) { | ||
@@ -178,6 +181,2 @@ return this.queue.remove(message)["catch"]((function(_this) { | ||
LongTaskQueueReader.prototype._timeToTouch = function() { | ||
return convert(this.visibilityTimeout).from("s").to("ms") / 2; | ||
}; | ||
return LongTaskQueueReader; | ||
@@ -184,0 +183,0 @@ |
{ | ||
"name": "long-task-queue-reader", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "long-task-queue-reader", | ||
@@ -32,3 +32,5 @@ "main": "index.js", | ||
"mocha": "3.0.2", | ||
"should": "11.1.0" | ||
"should": "11.1.0", | ||
"should-sinon": "0.0.5", | ||
"sinon": "^1.17.6" | ||
}, | ||
@@ -35,0 +37,0 @@ "author": "Parsimotion", |
68681
13
377
12