Skip to content

Commit

Permalink
Remove the lazy client error handler on close
Browse files Browse the repository at this point in the history
  • Loading branch information
lavarsicious committed Jan 3, 2020
1 parent 081b37f commit 3b7b78d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/queue.js
Expand Up @@ -144,7 +144,9 @@ const Queue = function Queue(name, url, opts) {
this.clients = [];
const lazyClient = redisClientGetter(this, opts, (type, client) => {
// bubble up Redis error events
client.on('error', this.emit.bind(this, 'error'));
const handler = this.emit.bind(this, 'error');
client.on('error', handler);
this.once('close', () => client.removeListener('error', handler));

if (type === 'client') {
this._initializing = commands(client).then(
Expand Down Expand Up @@ -561,6 +563,7 @@ Queue.prototype.close = function(doNotWaitJobs) {
.finally(() => {
this.childPool && this.childPool.clean();
this.closed = true;
this.emit('close');
}));
};

Expand Down

0 comments on commit 3b7b78d

Please sign in to comment.