-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
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.
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.)
e4e6713
to
3ea8ff2
Compare
I believe I've made the changes requested. Let me know if this newer pull request 3ea8ff2 isn't what you were asking for. |
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.
Yep, exactly!
3ea8ff2
to
2b3c148
Compare
I've updated the patch. Let me know what you think. |
@brianc Any thoughts on this PR? Would love to see it incorporated into node-postgres sooner than later if it passes muster. |
Yeah it looks good, sorry for missing this. I'll try to get this released today! |
@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! |
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! |
Ok. Thanks. |
This addresses issue #2027 "Add optional maximum connection lifetime parameter"
#2027
Adds the optional
maxLifetimeSeconds
parameter to thePool
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.