mirror of
https://github.com/OptimalBits/bull.git
synced 2026-07-02 00:17:41 +08:00
fix(queue): return correct workers with getWorkers()
This commit is contained in:
@@ -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
@@ -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
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user