rsmq-worker
Advanced tools
Comparing version 0.4.1 to 0.4.2
(function() { | ||
exports.version = '0.4.1'; | ||
exports.version = '0.4.2'; | ||
@@ -4,0 +4,0 @@ module.exports = require('./lib/rsmq-worker'); |
@@ -57,2 +57,5 @@ (function() { | ||
this.queuename = queuename; | ||
if (options == null) { | ||
options = {}; | ||
} | ||
this.next = bind(this.next, this); | ||
@@ -70,2 +73,3 @@ this.interval = bind(this.interval, this); | ||
this.send = bind(this.send, this); | ||
this.quit = bind(this.quit, this); | ||
this.stop = bind(this.stop, this); | ||
@@ -130,5 +134,8 @@ this.start = bind(this.start, this); | ||
RSMQWorker.prototype.stop = function() { | ||
this.stopped = true; | ||
if (this.timeout != null) { | ||
clearTimeout(this.timeout); | ||
if (!this.stopped) { | ||
this.stopped = true; | ||
if (this.timeout != null) { | ||
clearTimeout(this.timeout); | ||
} | ||
this.emit("stopped"); | ||
} | ||
@@ -140,2 +147,21 @@ return this; | ||
/* | ||
## quit | ||
`RSMQWorker.quit()` | ||
Stop the worker and quit the connection | ||
@api public | ||
*/ | ||
RSMQWorker.prototype.quit = function() { | ||
this.stop(); | ||
if (this.queue != null) { | ||
this.queue.quit(); | ||
this.queue = null; | ||
} | ||
}; | ||
/* | ||
## send | ||
@@ -142,0 +168,0 @@ |
{ | ||
"name": "rsmq-worker", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "RSMQ helper to simply implement a worker around the message queue", | ||
@@ -33,6 +33,6 @@ "keywords": [], | ||
"should": "8.x", | ||
"grunt": "0.4.x", | ||
"grunt": "1.x", | ||
"grunt-contrib-watch": "1.x", | ||
"grunt-contrib-coffee": "1.x", | ||
"grunt-include-replace": "3.x", | ||
"grunt-include-replace": "4.x", | ||
"grunt-mocha-cli": "2.x", | ||
@@ -39,0 +39,0 @@ "grunt-docker": "0.x", |
@@ -93,3 +93,5 @@ ![RSMQ-Worker](https://trello-attachments.s3.amazonaws.com/5481963992d9ba3848568a1b/600x194/61b3b6117eeb0881c919c6996adb2620/rsmq_worker_small.png) | ||
Stop the receive interval. | ||
Just stop the receive interval. | ||
This will not cut the connection to rsmq/redis. | ||
If you want you script to end call `.quit()` | ||
@@ -139,2 +141,8 @@ **Return** | ||
### `.quit()` | ||
Stop the worker and close the connection. | ||
After this it's no longer possible to reuse the worker-instance. | ||
It's just intended to kill all timers and connections so your script will end. | ||
## Events | ||
@@ -303,2 +311,3 @@ | ||
|:--:|:--:|:--| | ||
|0.4.2|2016-05-06|Added the `.quit()` function [Issue#11](https://github.com/mpneuried/rsmq-worker/issues/11). Thanks to [Sam Fung](https://github.com/5amfung )| | ||
|0.4.1|2016-04-05|Fixed missing isNumber function| | ||
@@ -305,0 +314,0 @@ |0.4.0|2016-03-30|Updated dependencies (especially lodash to 4.x). Fixed a config bug caused by the array merge from `extend` [Issue#7](https://github.com/mpneuried/rsmq-worker/issues/7). Thanks to [Peter Hanneman](https://github.com/timelessvirtues )| |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
652
358
37504
9