Handling of a message may cause a controller to unregister itself. Without the changes in this PR, this leads to a runtime error:
2024-01-19 11:58:15.996 ERROR (Thread-8) [pychromecast.socket_client] [Cellar display(192.168.0.114):8009] Unhandled exception in worker thread, attempting reconnect
Traceback (most recent call last):
File "/home/erik/development/pychromecast_fork/pychromecast/socket_client.py", line 564, in run
if self.run_once(timeout=POLL_TIME_BLOCKING) == 1:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/erik/development/pychromecast_fork/pychromecast/socket_client.py", line 669, in run_once
self._route_message(message, data)
File "/home/erik/development/pychromecast_fork/pychromecast/socket_client.py", line 741, in _route_message
for handler in self._handlers[message.namespace]:
RuntimeError: Set changed size during iteration
Handling of a message may cause a controller to unregister itself. Without the changes in this PR, this leads to a runtime error: