diff --git a/index.js b/index.js index af86134..392c346 100644 --- a/index.js +++ b/index.js @@ -24,7 +24,7 @@ function throwOnRelease () { function release (client, err) { client.release = throwOnRelease - if (err || this.ending) { + if (err || this.ending || client._do_not_return_) { this._remove(client) this._pulseQueue() return @@ -181,6 +181,7 @@ class Pool extends EventEmitter { this.log('additional client error after disconnection due to error', err) }) this._remove(client) + client._do_not_return_ = true; // TODO - document that once the pool emits an error // the client has already been closed & purged and is unusable this.emit('error', err, client)