Skip to content

Commit 7497554

Browse files
authored
Add exception logging on connection auto close (#3048)
1 parent 1f97c3c commit 7497554

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

sanic/server/websockets/impl.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,13 @@ async def auto_close_connection(self) -> None:
425425
return
426426
except asyncio.CancelledError:
427427
...
428+
except BaseException:
429+
websockets_logger.exception("Error closing websocket connection")
428430
finally:
431+
# Does this still exist?
432+
if self.keepalive_ping_task:
433+
self.keepalive_ping_task.cancel()
434+
self.keepalive_ping_task = None
429435
# The try/finally ensures that the transport never remains open,
430436
# even if this coroutine is cancelled (for example).
431437
if (not self.io_proto) or (not self.io_proto.transport):

0 commit comments

Comments
 (0)