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

Prevent requeuing a broken client #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johanneswuerbach
Copy link
Contributor

@johanneswuerbach johanneswuerbach commented Feb 11, 2019

This is a request for comments, feedback welcome.

If a client is not queryable, the pool should prevent requeuing instead of strictly enforcing errors to be propagated back to it.

I feel this is better behaviour as otherwise a missing error passing will cause an invalid query to be constantly checked out, queries to error and client being re-added to the pool.

If a client is not queryable, the pool should prevent requeuing instead
of strictly enforcing errors to be propagated back to it.
@@ -30,7 +30,7 @@ function throwOnRelease () {

function release (client, err) {
client.release = throwOnRelease
if (err || this.ending) {
if (err || this.ending || !client._queryable || client._ending) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if the queryable state of a client is retrievable via a public method.

@@ -30,7 +30,7 @@ function throwOnRelease () {

function release (client, err) {
client.release = throwOnRelease
if (err || this.ending) {
if (err || this.ending || !client._queryable || client._ending) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively re-adding a not queryable client could throw instead of silently re-adding.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant