Publisher Client `close()` method
See original GitHub issueIs your feature request related to a problem? Please describe.
There’s currently no method to close a client. I’m using the client in a persistent environment, which isn’t guaranteed to be actively processing data at any given time.
If there’s a delay between messages, there’s a chance that the network connection fails to resolve, eg. if the connection is closed on the server side but not client side.
In order to cover this, I need to open a new connection and I have no way to close the stale one, so basically this eventually leads to a proliferation of open but unused sockets.
Describe the solution you’d like
A client.close()
method which allows me to terminate a client connection client-side.
Describe alternatives you’ve considered
Manually closing sockets or terminating the entire environment every time we hit a stale connection are the only real options I can see - neither are desirable for obvious reasons.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
@merlinnot just added to the schedule for our next library group meeting; @feywind probably worth having this on your radar 👍
@feywind Some edge cases were discussed in this thread: https://github.com/grpc/grpc-node/pull/1083. It’s quite lengthy, but it took quite some time to get to a common understanding. Bottom line: there are some scenarios where having a
close
method is strictly necessary and there’s no way around it. That’s why a patch was made to @grpc/grpc-js, then googleapis/gapic-generator-typescript and then googleapis/nodejs-firestore.While I do acknowledge and understand that this is not necessary in most of the scenarios, power users do and will always require it for more advanced scenarios.