-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Different behavior calling .end() on a non connected Client between 7.17 and 7.18 #2108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
nope! not an expected change. hanging indefinitely is never my intended
behavior! i didn't really think about what would happen if you call .close
on an unconnected client. i think it should just silently do
nothing...what do you think? i can write a test for this behavior and
ensure it stays consistent going forward
…On Thu, Feb 20, 2020 at 10:07 AM Daniel Contreras ***@***.***> wrote:
Calling client.end() on a Client not connected in ***@***.*** fails with an
error message
Socket is closed
However in ***@***.*** the same call just hangs indefinitely. I'm using the
promise-based call (without the callback) and awaiting the promise to
fulfil.
Is this an expected change?
If the context matters, I have a wrapper around a Client and I'm "unit
testing" that a call to its closing function throws if the wrapped client
is not connected. Before I was just calling .end() on the inner client
but now the test fails since the promise never fulfilled.
If the change is expected, is there a way of knowing if a given Client is
connected?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2108?email_source=notifications&email_token=AAAMHIODDE4GV5GD5REZMF3RD2TFTA5CNFSM4KYR6YF2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IPBGP6A>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAMHIL7JPMVGMRK3D3X2GDRD2TFTANCNFSM4KYR6YFQ>
.
|
Yep. As long a it is consistent and documented a In our case we do want to throw in that case since it can only happen due a developer mistake and not as a normal flow path; our wrapper can throw if the inner client is not connected and |
* Call callback when end called on unconnected client Closes #2108 * Revert a bit of the change * Use readyState because pending doesn't exist in node 8.x * Update packages/pg/lib/client.js use bring your own promise Co-Authored-By: Charmander <[email protected]> Co-authored-by: Charmander <[email protected]>
Calling
client.end()
on aClient
not connected in[email protected]
fails with an error messageHowever in
[email protected]
the same call just hangs indefinitely. I'm using the promise-based call (without the callback) andawait
ing the promise to fulfil.Is this an expected change?
If the context matters, I have a wrapper around a
Client
and I'm "unit testing" that a call to its closing function throws if the wrapped client is not connected. Before I was just calling.end()
on the inner client but now the test fails since the promise never fulfilled.If the change is expected, is there a way of knowing if a given
Client
is connected?The text was updated successfully, but these errors were encountered: