fix(queue): return correct workers with getWorkers()

This commit is contained in:
Manuel Astudillo
2022-02-14 19:22:58 +08:00
committed by GitHub
parent d11a9fff1b
commit 193644c5ed
3 changed files with 6 additions and 6 deletions
-1
View File
@@ -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));
+1 -1
View File
@@ -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;
+5 -4
View File
@@ -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);
});
});