Thank you, Richard!

1. In general, the channel will remain open indefinitely regardless of the 
state of the underlying TCP connection.

That’s good to know 👍
 
2. In most cases, __del__ will probably fine, but __del__ is not reliably 
called when an object goes out of scope. It may happen an arbitrary amount 
of time after that. If you're *really* worried about deterministically 
closing the connection, you'll want to add an explicit close method that 
closes the channel.

Well, I’m opening the Channel and create the Stub in the Servicer’s 
__init__() 
<https://docs.python.org/3/reference/datamodel.html#object.__init__> 
initializer, so the only sensible place to close the Channel would be upon 
finalizing/destroying the instance (hence using __del__() 
<https://docs.python.org/3/reference/datamodel.html#object.__del__>). I 
understand that that’s not a reliable way of freeing that resource but 
considering the Channel is tied to the lifetime of the Servicer instance, 
it’s probably as good as it gets… 🤔

Cheers,
Jens

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/28e7c3ef-9349-42bb-9eac-f1ecc868b479n%40googlegroups.com.

Reply via email to