Skip to content

Commit

Permalink
Mark clients with closed connections as unusable consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
charmander committed Nov 15, 2017
1 parent 4c58e3f commit 9c2ba4b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/client.js
Expand Up @@ -208,10 +208,10 @@ Client.prototype.connect = function (callback) {
if (callback) {
callback(error)
} else {
this.emit('error', error)
connectedErrorHandler(error)
}
} else if (!this._connectionError) {
this.emit('error', error)
connectedErrorHandler(error)
}
}
this.emit('end')
Expand Down
2 changes: 1 addition & 1 deletion test/integration/connection-pool/error-tests.js
Expand Up @@ -60,7 +60,7 @@ suite.test('connection-level errors cause queued queries to fail', (cb) => {
}))

client.query('SELECT 1', assert.calls((err) => {
assert.equal(err.code, 'EPIPE')
assert.equal(err.message, 'Connection terminated unexpectedly')

done()
pool.end()
Expand Down

0 comments on commit 9c2ba4b

Please sign in to comment.