mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Fix set size changed during iteration
This commit is contained in:
parent
8cada1c450
commit
cb064f95df
@ -85,7 +85,10 @@ class WebSocketHelper:
|
||||
self.broadcast_with_fn(filter_fn, event_type, data)
|
||||
|
||||
def broadcast_with_fn(self, filter_fn, event_type: str, data):
|
||||
clients = list(filter(filter_fn, self.clients))
|
||||
# assign self.clients to a static variable here so hopefully
|
||||
# the set size won't change
|
||||
static_clients = self.clients
|
||||
clients = list(filter(filter_fn, static_clients))
|
||||
logger.debug(
|
||||
f"Sending to {len(clients)} out of {len(self.clients)} "
|
||||
f"clients: {json.dumps({'event': event_type, 'data': data})}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user