Add connection lifetime limit option and tests#2668
Conversation
charmander
left a comment
There was a problem hiding this comment.
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. |
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
maxLifetimeSecondsparameter to thePoolconstructor. 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.