Allow single queue regist multiple times #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please ignore the first 2 commit. It was because I needed to understand how this work and I don't code in
coffee-scriptThis basically allow you to run multiple queue listener on a single process and prevent a message process more than once in the same process.
This PR also fix some of typo and allow the coffee-script to compile on latest
coffee-scriptnpmSome mocha test are fixed and it run fine on my machine.
The reason I needed this is because I was creating some queue that will run AWS Lambda function. But I encounter exactly the same problem this package was trying to resolve. Since to trigger a lambda function, it does not require a lot of resource, but I need a small timeout for each operation (30s - 60s) so it's will not be feasible if I run multiple node processes to archive my result.
I also try to use
fairy.queue('worker_queue');inside a loop and this create multiple connection to redis, which spike CPU up to 200% in large quantity.So I added a fix to allow multiple
registand allow message to be use once across all workers in a queue with a single Redis connection.Here's an example of how it work:
sender.jsreceiver.jsThanks for the amazing package! Though I would prefer if you can continue maintain it and maybe change it to ES6 and I am sure there will be a lot more contribution