Skip to content

pool.end() resolves before the last pool.query() #3461

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

hjr3
Copy link
Collaborator

@hjr3 hjr3 commented May 10, 2025

dupe of #3254 with 289273c to fix the failing test

Copy link

cloudflare-workers-and-pages bot commented May 10, 2025

Deploying node-postgres with  Cloudflare Pages  Cloudflare Pages

Latest commit: 289273c
Status: ✅  Deploy successful!
Preview URL: https://6a8ab911.node-postgres.pages.dev
Branch Preview URL: https://push-mpvwkrquvyqr.node-postgres.pages.dev

View logs

@hjr3
Copy link
Collaborator Author

hjr3 commented May 11, 2025

note: if we want to merge this, then i should update the docs for https://node-postgres.com/apis/pool#remove to document the change in behavior

@brianc
Copy link
Owner

brianc commented May 12, 2025

note: if we want to merge this, then i should update the docs for https://node-postgres.com/apis/pool#remove to document the change in behavior

Would you consider this a bug-fix or a breaking change? Seems to me like its a semantic alignment w/ expectations and more of a fix than a break, and no exising tests required changing so its more of a patch than a semver major. But I'd love to hear your thoughts!

@hjr3
Copy link
Collaborator Author

hjr3 commented May 12, 2025

I agree this is a fix. No one expects pool.end to resolve before the last pool.query. Also, the documentation did not state that remove event is emitted prior to client end finishing.

edit:
Docs for remove event:

Whenever a client is closed & removed from the pool the pool will emit the remove event.

So, I would say that the expectation is that the client has been closed. Even more strongly in the "fix" camp. Maybe no change in behavior needs to be documented either.

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

Successfully merging this pull request may close these issues.

3 participants