-
Notifications
You must be signed in to change notification settings - Fork 73
Wait for a pending connection when acquiring #122
Conversation
Nice catch. Can you please add unittests for the two cases you describe? Thanks. |
Thanks :) Sure can! I'll try to add those in the next day or two. |
Hi, |
Hi! I've been away. What do you use to develop/run the tests? maybe I'll have better luck in a VM of a similar setup. |
I'm running on Ubuntu 14.04. Travis CI environment runs Ubuntu as well. I suggest using Ubuntu 14.04 VM. Get it working on a single version of Let me know if you need any further help. On Mon, Oct 5, 2015 at 9:28 PM, James Bowes notifications@github.com
Zaar |
updated with tests :) |
Makes sense to me! I'll implement that and add a few tests to ensure callers will get exceptions. |
There are two cases when a caller might ask for a connection when the only available ones are in a pending state: - Upon initialization, if the caller hasn't waited for `connect()` to complete. - After all connections to the database are lost, and they are reconnecting. Instead of immediately returning an error to the caller, add them to the waiting queue, allowing them to either get a connection, or return an error if none of the pending connections succeed.
Another gentle ping :) |
Oh! It's all updated and passing... I forgot to leave a comment though 😿 |
Wait for a pending connection when acquiring
Thank you! |
My pleasure:) |
There are two cases when a caller might ask for a connection when the
only available ones are in a pending state:
connect()
tocomplete.
reconnecting.
Instead of immediately returning an error to the caller, add them to the
waiting queue, allowing them to either get a connection, or return an
error if none of the pending connections succeed.