Skip to content

Commit

Permalink
Fix x not in list error in memory websocket manager (#368)
Browse files Browse the repository at this point in the history
* Fix x not in list error in memory websocket manager

* Fix incorrect if in close of memory ws manager
  • Loading branch information
tjeerddie authored Oct 2, 2023
1 parent df326f3 commit fbd52e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions orchestrator/websocket/managers/memory_websocket_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ async def broadcast_data(self, channels: List[str], data: Dict) -> None:
async def remove_ws(self, websocket: WebSocket, channel: str) -> None:
if websocket.client_state != WebSocketState.DISCONNECTED:
await self.disconnect(websocket)
if channel in self.connections_by_pid:
if channel in self.connections_by_pid and websocket in self.connections_by_pid[channel]:
self.connections_by_pid[channel].remove(websocket)
if len(self.connections_by_pid[channel]):
if not len(self.connections_by_pid[channel]):
del self.connections_by_pid[channel]
self.log_amount_of_connections()

Expand Down

0 comments on commit fbd52e7

Please sign in to comment.