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
The modern implementation, which simply pukes a RuntimeErrror...
def set_exception(self, exception):
raise RuntimeError('Task does not support set_exception operation')
...causes handle_connection_close cancel_tasks loop to fail on the first set_exception call. It's not clear what this loop is trying to accomplish since it isn't canceling any pending tasks.
@asyncio.coroutine
def handle_connection_close(self):
def cancel_tasks():
self._no_more_connections.set()
while self.client_tasks:
task = self.client_tasks.popleft()
if not task.done():
task.set_exception(ClientException("Connection lost")) # BOOM THE LOOP EXITS AND EXCEPTION PROPAGATED
Perhaps it should be?
self._no_more_connections.set() // moved from above
if self.config.get('auto_reconnect', False):
# Try reconnection
self.logger.debug("Auto-reconnecting")
try:
yield from self.reconnect()
except ConnectException:
# Cancel client pending tasks
# REPLACE? cancel_tasks()
yield from self.cancel_tasks()
else:
# Cancel client pending tasks
# REPLACE? cancel_tasks()
yield from self.cancel_tasks()
The text was updated successfully, but these errors were encountered:
set_exception was removed from asyncio some time ago per https://bugs.python.org/issue32363
The modern implementation, which simply pukes a RuntimeErrror...
...causes handle_connection_close cancel_tasks loop to fail on the first set_exception call. It's not clear what this loop is trying to accomplish since it isn't canceling any pending tasks.
Perhaps it should be?
The text was updated successfully, but these errors were encountered: