Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set change during iteration when dispatching listeners
An existing listener may add new listeners to process ServiceInfo when it sees a record. We need to make a copy of the listeners set before iterating them to avoid `set changed size during iteration` Fixes ``` 2024-04-12 16:31:25.699 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback _SelectorDatagramTransport._read_ready() Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/selector_events.py", line 1248, in _read_ready self._protocol.datagram_received(data, addr) File "src/zeroconf/_listener.py", line 86, in zeroconf._listener.AsyncListener.datagram_received File "src/zeroconf/_listener.py", line 104, in zeroconf._listener.AsyncListener.datagram_received File "src/zeroconf/_listener.py", line 175, in zeroconf._listener.AsyncListener._process_datagram_at_time File "src/zeroconf/_handlers/record_manager.py", line 161, in zeroconf._handlers.record_manager.RecordManager.async_updates_from_response File "src/zeroconf/_handlers/record_manager.py", line 70, in zeroconf._handlers.record_manager.RecordManager.async_updates_complete RuntimeError: set changed size during iteration ```
- Loading branch information