Skip to content

Commit

Permalink
fix(queue): return correct workers with getWorkers()
Browse files Browse the repository at this point in the history
  • Loading branch information
manast authored Feb 14, 2022
1 parent d11a9ff commit 193644c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion lib/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ function redisClientGetter(queue, options, initCallback) {
return connections[type];
}
const clientOptions = _.assign({}, options.redis);
clientOptions.connectionName = this.clientName();

const client = (connections[type] = createClient(type, clientOptions));

Expand Down
2 changes: 1 addition & 1 deletion lib/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = function(Queue) {
return utils
.isRedisReady(this.client)
.then(() => {
return this.client.client('setname', this.clientName());
return this.bclient.client('setname', this.clientName());
})
.catch(err => {
if (!clientCommandMessageReg.test(err.message)) throw err;
Expand Down
9 changes: 5 additions & 4 deletions test/test_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ describe('workers', () => {
});
});

it('should get all workers for this queue', () => {
it('should get all workers for this queue', async () => {
queue.process(() => {});

return queue.getWorkers().then(workers => {
expect(workers).to.have.length(1);
});
await queue.bclient.ping();

const workers = await queue.getWorkers();
expect(workers).to.have.length(1);
});
});

0 comments on commit 193644c

Please sign in to comment.