fix: make a copy of websockets before broadcasting
This commit is contained in:
parent
a1fa762ea8
commit
e984e70390
1 changed files with 3 additions and 1 deletions
4
main.py
4
main.py
|
@ -40,7 +40,9 @@ class ConnectionManager:
|
|||
|
||||
async def broadcast(self, ws_type: WSConnectionType, message: BaseModel):
|
||||
broken = set()
|
||||
for ws in self.active_connections[ws_type.value]:
|
||||
conn_list = list(self.active_connections[ws_type.value])
|
||||
for idx in range(len(conn_list)):
|
||||
ws = conn_list[idx]
|
||||
try:
|
||||
await ws.send_json(message.model_dump())
|
||||
except Exception:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue