You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I don't think calling private methods should be "the best solution".
I thought I could get around this by calling await connection.close() (which results in calling _on_close()) in the CancelledError handler, however, there's a check for is_closed right at the top (and this check is also present in the __closer() callback.
... because is_closed returns true, the _on_close() will never get called.
My proposed solution would be to add_done_callback on the closing future, that calls _on_close, but this would also require to do a better check in the callbacks methods (instead of just is_closed).
I hope my explanation wasn't too much confusing, hit me back if you'd like me to clarify something.
The text was updated successfully, but these errors were encountered:
await connection.closing
close()
method, but e.g. when Ctrl+C is pressed duringasyncio.run
), the_on_close()
method is never called.I can call this method manually, like this:
But I don't think calling private methods should be "the best solution".
I thought I could get around this by calling
await connection.close()
(which results in calling_on_close()
) in theCancelledError
handler, however, there's a check foris_closed
right at the top (and this check is also present in the__closer()
callback.... because
is_closed
returns true, the_on_close()
will never get called.My proposed solution would be to
add_done_callback
on theclosing
future, that calls_on_close
, but this would also require to do a better check in the callbacks methods (instead of justis_closed
).I hope my explanation wasn't too much confusing, hit me back if you'd like me to clarify something.
The text was updated successfully, but these errors were encountered: