fix(gateway): tolerate cancelled channel tasks during shutdown
This commit is contained in:
@@ -252,6 +252,10 @@ class ChannelManager:
|
||||
try:
|
||||
await channel.stop()
|
||||
logger.info("Stopped {} channel", name)
|
||||
except asyncio.CancelledError:
|
||||
if asyncio.current_task() and asyncio.current_task().cancelling():
|
||||
raise
|
||||
logger.debug("Channel {} stop task was already cancelled", name)
|
||||
except Exception:
|
||||
logger.exception("Error stopping {}", name)
|
||||
|
||||
|
||||
@@ -827,6 +827,10 @@ class WebSocketChannel(BaseChannel):
|
||||
if self._server_task:
|
||||
try:
|
||||
await self._server_task
|
||||
except asyncio.CancelledError:
|
||||
if asyncio.current_task() and asyncio.current_task().cancelling():
|
||||
raise
|
||||
self.logger.debug("server task was already cancelled during shutdown")
|
||||
except Exception as e:
|
||||
self.logger.warning("server task error during shutdown: {}", e)
|
||||
self._server_task = None
|
||||
|
||||
Reference in New Issue
Block a user