Update queue index while enqueueing jobs to the top of queue

This commit is contained in:
Daniel García Aubert 2017-04-05 11:43:29 +02:00
parent bc43680202
commit 7d24ce671b
2 changed files with 14 additions and 1 deletions

View File

@ -3,6 +3,9 @@
## 1.44.2 ## 1.44.2
Released 2017-mm-dd Released 2017-mm-dd
Bug fixes:
- Update queue index while enqueueing jobs to the top of queue.
## 1.44.1 ## 1.44.1
Released 2017-04-04 Released 2017-04-04

View File

@ -63,7 +63,17 @@ JobQueue.prototype.dequeue = function (user, callback) {
JobQueue.prototype.enqueueFirst = function (user, jobId, callback) { JobQueue.prototype.enqueueFirst = function (user, jobId, callback) {
debug('JobQueue.enqueueFirst user=%s, jobId=%s', user, jobId); debug('JobQueue.enqueueFirst user=%s, jobId=%s', user, jobId);
this.metadataBackend.redisCmd(QUEUE.DB, 'RPUSH', [ QUEUE.PREFIX + user, jobId ], callback); this.metadataBackend.redisMultiCmd(QUEUE.DB, [
[ 'RPUSH', QUEUE.PREFIX + user, jobId ],
[ 'SADD', QUEUE.INDEX, user ]
], function (err) {
if (err) {
return callback(err);
}
this.jobPublisher.publish(user);
callback();
}.bind(this));
}; };