Closed kevinburkeshyp closed 7 years ago
Note, this builds on #125, so both commits are present in the diff. Happy to rebase/merge/submit against the branch/whatever you like.
I pushed 81c28ad with a fudge for the timer tests. I'm not too happy with it. I can rebase down before merge.
+1
+1
Just an update. I'm sorry for the delay, work and life have been rather hectic at the moment, but I've scheduled in some time to look at this after Wednesday. Thanks for the patience
Removed the block option in 5e4bf20. I can rebase down before merge.
Pushed the error callback to the next tick in 295e00a.
Lint errors should be fixed in 5556a81.
thanks
(passive aggresive internal voice): I WILL finish looking at this soon and merge it!
Great stuff. Waiting for this publish.
@sandfox thoughts here? wondering if we should fork this lib & node-postgres or wait for upstream
@kevinburkeshyp this is for reals actually open in my text editor and I'm looking at it now :-)
Thanks!
I've published this PR as a new package here: https://www.npmjs.com/package/generic-pool-timeout and submitted it for inclusion as part of node-postgres here: https://github.com/brianc/node-postgres/pull/1006.
hey @sandfox - anything I can do to help push this across the finish line? code review other PR's? make a donation?
Hi Kevin,
Sorry for the haitus on this, I had a bit of collision of burnout, changing jobs, and some personal stuff. Anywayaaay, onto code! Whilst looking at adding some other features I had to make some more big refactors on top you work and after various iterations and dead ends I've ended up realising alot of the future work isn't possible with jamming event-emitters into the lib/api.
The branch much features should have an implementation of the feature you are after, with some slight changes to accomodate other features. There are still a couple of test failures outstanding which I don't think can fixed without add event-emitters (which incidentally is needed to properly isolate the resource creation cycle/aspect from the resource issuance aspect/cycle, originally the two were too tightly coupled. A thing requesting a resource shouldn't care/know/etc about the resource factory having errors creating individual resources (but it will still obviously care about an overall failure to be able to create resources)).
The side effect of this is that the API change will probably mean a major version number bump which I wanted to avoid, but maybe that isn't a bad thing.
closing as this is now included as part of v3
The
options
dictionary for pool.acquire() now takes a second argument,timeout
. Pass an integer number of milliseconds to cancel the acquire() call and hit the callback with pool.Full after the given amount of time has elapsed. Hits the callback with an immediate error if the timeout is a negative number, zero, or NaN.Adds a number of tests that this logic behaves as expected.
This work was sponsored by Shyp.