Prevent runtime issue during entity registration in coordinator of AVM Fritz!Tools (#108667)
prevent dictionary changed size during iteration
This commit is contained in:
parent
80207835d7
commit
3d1751bdfa
2 changed files with 4 additions and 5 deletions
|
@ -315,12 +315,14 @@ class FritzBoxTools(
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
await self.async_scan_devices()
|
await self.async_scan_devices()
|
||||||
for key, update_fn in self._entity_update_functions.items():
|
for key in list(self._entity_update_functions):
|
||||||
_LOGGER.debug("update entity %s", key)
|
_LOGGER.debug("update entity %s", key)
|
||||||
entity_data["entity_states"][
|
entity_data["entity_states"][
|
||||||
key
|
key
|
||||||
] = await self.hass.async_add_executor_job(
|
] = await self.hass.async_add_executor_job(
|
||||||
update_fn, self.fritz_status, self.data["entity_states"].get(key)
|
self._entity_update_functions[key],
|
||||||
|
self.fritz_status,
|
||||||
|
self.data["entity_states"].get(key),
|
||||||
)
|
)
|
||||||
if self.has_call_deflections:
|
if self.has_call_deflections:
|
||||||
entity_data[
|
entity_data[
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from homeassistant.components.fritz.const import DOMAIN
|
from homeassistant.components.fritz.const import DOMAIN
|
||||||
from homeassistant.components.update import DOMAIN as UPDATE_DOMAIN
|
from homeassistant.components.update import DOMAIN as UPDATE_DOMAIN
|
||||||
from homeassistant.config_entries import ConfigEntryState
|
from homeassistant.config_entries import ConfigEntryState
|
||||||
|
@ -49,7 +47,6 @@ async def test_update_entities_initialized(
|
||||||
assert len(updates) == 1
|
assert len(updates) == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail(reason="Flaky test")
|
|
||||||
async def test_update_available(
|
async def test_update_available(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_client: ClientSessionGenerator,
|
hass_client: ClientSessionGenerator,
|
||||||
|
|
Loading…
Add table
Reference in a new issue