-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
pg-pool: don't allow connection reuse after streaming #2832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pg-pool: don't allow connection reuse after streaming #2832
Conversation
packages/pg-pool/index.js
Outdated
@@ -331,7 +331,7 @@ class Pool extends EventEmitter { | |||
client._poolUseCount = (client._poolUseCount || 0) + 1 | |||
|
|||
// TODO(bmc): expose a proper, public interface _queryable and _ending | |||
if (err || this.ending || !client._queryable || client._ending || client._poolUseCount >= this.options.maxUses) { | |||
if (err || this.ending || !client._queryable || client._ending || client._poolUseCount >= this.options.maxUses || client?.activeQuery?.cursor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably isn't the correct way to check if the activeQuery is a QueryStream
, but using isntanceof
doesn't seem appropriate: AFAICT there's currently no dependency from pg-pool
-> pg-query-stream
, and there probably shouldn't be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn’t a good hack. I don’t think it should be merged.
@charmander thanks for the feedback, I don't disagree. If it was good, it wouldn't be a hack 😄 Does the test case look valid to you? Perhaps Do you have any suggestions on a more correct approach to fixing the issue? |
Closing in favour of #2836. |
This might be a fix for #1674.
I would expect that connections could be re-used safely after streaming though, so there should be a more correct way of approaching this...