-
Notifications
You must be signed in to change notification settings - Fork 64
Prevent double release with callback #115
Prevent double release with callback #115
Conversation
95ed717
to
40482a0
Compare
When using the callback instead of client.release, double releasing a client was possible causing clients to be re-added multiple times.
40482a0
to
27a889e
Compare
Code changes look good. Thanks for diving in here. Question is....do you think this is a minor or major version bump? I feel more so like it's minor as the old behavior was undefined or would introduce silent bugs...but it does change the behavior. What you think? |
I would see this as a (critical) bug fix as releasing the same client multiple times will result in multiple idleQueue entries all referencing the same client, which will cause various other problems. |
patch version then...yeah? |
I would say so, the same behaviour was already happening when calling |
@brianc any idea when you plan to merge this? I would like to use it on my project. |
@brianc friendly ping :-) |
@brianc anything else required to move this forward? |
Fixed in #123 |
When using the
done
callback instead ofclient.release
, double releasing a client was possible causing clients to be re-added multiple times.Ensure that the release method itself can't be called twice instead of patching on the client.
I also did a small refactoring to ensure that new client and re-used client acquiring goes through the same code path and moved release into the client instead of using bind. Happy to remove this, but I found the logic a bit more readable afterwards.