Don't try to remove websocket from log listeners if it had not been added

This commit is contained in:
Tulir Asokan 2018-11-29 12:28:23 +02:00
parent 2b8a5353be
commit 30a6dd62ef

View file

@ -133,7 +133,8 @@ async def log_websocket(request: web.Request) -> web.WebSocketResponse:
await ws.close() await ws.close()
except Exception: except Exception:
pass pass
handler.listeners.remove(ws) if authenticated:
handler.listeners.remove(ws)
log.debug(f"Connection from {request.remote} closed") log.debug(f"Connection from {request.remote} closed")
sockets.remove(ws) sockets.remove(ws)
return ws return ws