Skip to content
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

Add connection lifetime limit option and tests #2668

Closed
wants to merge 0 commits into from

Conversation

ChrisWritable
Copy link
Contributor

This addresses issue #2027 "Add optional maximum connection lifetime parameter"
#2027

Adds the optional maxLifetimeSeconds parameter to the Pool constructor. If the parameter is left undefined or zero there is no change in behavior. When the parameter is set, it specifies a number of seconds to wait before recycling a connection. It waits until the connection is idle before recycling.

Copy link
Collaborator

@charmander charmander left a comment

Choose a reason for hiding this comment

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

Juggling indices (which change when you splice) feels uncomfortable. How about adding clients that are checked out when they expire to a WeakSet, then checking for previous expiration that way in release?

Also, this PR changes the mode of packages/pg-pool/index.js; could you revert that? (Or I can.)

@ChrisWritable
Copy link
Contributor Author

I believe I've made the changes requested. Let me know if this newer pull request 3ea8ff2 isn't what you were asking for.

Copy link
Collaborator

@charmander charmander left a comment

Choose a reason for hiding this comment

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

Yep, exactly!

@ChrisWritable
Copy link
Contributor Author

I've updated the patch. Let me know what you think.

@hempels
Copy link

hempels commented Jan 26, 2022

@brianc Any thoughts on this PR? Would love to see it incorporated into node-postgres sooner than later if it passes muster.

@brianc
Copy link
Owner

brianc commented Jan 26, 2022

Yeah it looks good, sorry for missing this. I'll try to get this released today!

@brianc
Copy link
Owner

brianc commented Jan 26, 2022

@ChrisWritable - would it be possible to rebase this PR on top of current master of this repo? Because the tests haven't been run in CI on this PR AFAICT - I ported them to run on github actions so if you rebase on master & push back to this PR it should run them. Then I will merge. Thanks for your patience!

@brianc
Copy link
Owner

brianc commented Jan 28, 2022

Thanks for the PR @ChrisWritable - just FYI in the future if you don't want to open a new PR I'm pretty sure force pushing to your existing branch will just update the existing PR w/ the new commits or history. Either way works though!

@ChrisWritable
Copy link
Contributor Author

Ok. Thanks.

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.

4 participants