Skip to content
This repository has been archived by the owner on Dec 30, 2019. It is now read-only.

Do not return broken connections to the idle pool #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down