mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-19 23:21:46 +03:00
daemon|util: Don't remove from list while iterating (#11208)
* daemon: Iterate over a copy of `websockets` Currently when it fails to send the response to one websocket it skips the next websocket in list becaue we remove from the list while iterating. * util: Iterate over a copy of `peers_with_peak` Currently when a peer is closed it skips the check for the next peer in the list becaue we remove from the list while iterating.
This commit is contained in:
parent
f9c4f1f96d
commit
c0f3d4d231
@ -613,7 +613,7 @@ class WebSocketServer:
|
||||
|
||||
response = create_payload("keyring_status_changed", keyring_status, "daemon", destination)
|
||||
|
||||
for websocket in websockets:
|
||||
for websocket in websockets.copy():
|
||||
try:
|
||||
await websocket.send_str(response)
|
||||
except Exception as e:
|
||||
@ -672,7 +672,7 @@ class WebSocketServer:
|
||||
|
||||
response = create_payload("state_changed", message, service, "wallet_ui")
|
||||
|
||||
for websocket in websockets:
|
||||
for websocket in websockets.copy():
|
||||
try:
|
||||
await websocket.send_str(response)
|
||||
except Exception as e:
|
||||
|
@ -15,7 +15,7 @@ async def check_fork_next_block(
|
||||
potential_peek = uint32(our_peak_height + 1)
|
||||
# This is the fork point in SES in the case where no fork was detected
|
||||
if blockchain.get_peak_height() is not None and fork_point_height == max_fork_ses_height:
|
||||
for peer in peers_with_peak:
|
||||
for peer in peers_with_peak.copy():
|
||||
if peer.closed:
|
||||
peers_with_peak.remove(peer)
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user