Fix improper cleanup of sessions

This commit is contained in:
Marks Polakovs 2020-04-14 11:28:43 +02:00
parent 2d084987b1
commit 9f2ae49483

View file

@ -150,7 +150,11 @@ class Session(object):
print(self.connection_id, "Deactivating")
self.running = False
if self.websocket is not None:
await self.websocket.send(json.dumps({"kind": "DEACTIVATED"}))
try:
await self.websocket.send(json.dumps({"kind": "DEACTIVATED"}))
except websockets.exceptions.ConnectionClosedError:
print(self.connection_id, "not sending DEACTIVATED as it's already closed")
pass
async def end(self) -> None:
global active_sessions, live_session