-
Notifications
You must be signed in to change notification settings - Fork 64
Conversation
test/index.js
Outdated
}, 10) | ||
}) | ||
pool.on('error', function (err) { | ||
// Allow all of the event handles to run before checking |
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.
Errant comment, cleaning this up on next push
5c2c72e
to
365a829
Compare
@brianc PTAL :) |
I really appreciate you trying to address this issue! I think it's something we can fix, however, your approach might need some adjustment: The We already monkey patch the https://github.com/brianc/node-pg-pool/blob/master/index.js#L125 So that would be a good place to start looking to add additional functionality. |
I broke everything out into SafeClient to keep it tidy, but I hadn't thought about things relying on the object type to be "Client". 😞 Let me see what I can hack together; I'll push it to this branch when it's ready. |
I'm having a heck of a time trying to make this work by modifying the client instances directly. The main advantage of abstracting it out with the SafeClient object was that the lifecycle of those instances was a single run from By modifying the client instances themselves, we're now responsible for tracking locks of some sort on each of the instances to ensure that the current caller actually owns the resource in question, and it seems like I'm constantly seeing failures in the @brianc Do you have any idea if [email protected] helps solve or mitigate this problem? I'm hesitant to force-push my experiments over top of this branch just yet, since it's a bit of a mess... |
Unfortunately this is never going to merge at this point & a new tact needs to be taken. |
closes #50
This will add an intermediate client object (SafeClient) that wraps calls to
.query
and.release
, with the goal of preventing reuse of objects that have been released back to the pool.Attempting to call
.query
after.release
will throw an error.