queue.isReady() throws error if client not initialized
Created by: gabegorelick
Description
If queue._initializing
is not set, queue.isReady()
will throw a TypeError: Cannot read property 'then' of undefined
at https://github.com/OptimalBits/bull/blob/c0ee6be03c6d47d60465d2bae0d2566d5bf0d661/lib/queue.js#L478
_initializing
is set when the main Redis client is initialized: https://github.com/OptimalBits/bull/blob/c0ee6be03c6d47d60465d2bae0d2566d5bf0d661/lib/queue.js#L150
Setting skipVersionCheck: true
is the only way to trigger this as far as I can tell. Otherwise, getRedisVersion(this.client)
will cause _initializing
to be set before the Queue
constructor returns.
Minimal, Working Test code to reproduce the issue.
const queue = new Queue('foo', {skipVersionCheck: true});
queue.isReady();
Bull version
develop
Additional information
Anything that calls isReady
will also throw, e.g. queue.close()
, queue.add()
, etc.