Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Commit

Permalink
Pass collection name options to monq worker
Browse files Browse the repository at this point in the history
If you create a monq client worker with an array of queue (and not simply using the '*'), the collection name in the options map is not pass through the underlaying methods (namely in the Queue instantiation).
  • Loading branch information
alebertacco authored Nov 10, 2016
1 parent ff545b2 commit 74ce334
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@ function Connection(uri, options) {
* @param {Object} options - an object with worker options
*/
Connection.prototype.worker = function (queues, options) {
var self = this;
var self = this,
opts;

if (queues === "*") {
var opts = {universal: true, collection: options.collection || 'jobs' };
opts = {universal: true, collection: options.collection || 'jobs' };
options.universal = true;
queues = [new Queue('*', opts)];
} else {
if (!Array.isArray(queues)) {
queues = [queues];
}

opts = {collection: options.collection || 'jobs' };
var queues = queues.map(function (queue) {
if (typeof queue === 'string') {
queue = self.queue(queue);
queue = self.queue(queue, opts);
}

return queue;
Expand Down

0 comments on commit 74ce334

Please sign in to comment.