Skip to content

Commit

Permalink
Only limit stats to started add-ons (home-assistant#90611)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Mar 31, 2023
1 parent f4c3412 commit 3e59687
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions homeassistant/components/hassio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,23 +870,25 @@ async def force_data_refresh(self) -> None:
self.hassio.get_os_info(),
)

addons = [
addon
for addon in self.hass.data[DATA_SUPERVISOR_INFO].get("addons", [])
if addon[ATTR_STATE] == ATTR_STARTED
all_addons = self.hass.data[DATA_SUPERVISOR_INFO].get("addons", [])
started_addons = [
addon for addon in all_addons if addon[ATTR_STATE] == ATTR_STARTED
]
stats_data = await asyncio.gather(
*[self._update_addon_stats(addon[ATTR_SLUG]) for addon in addons]
*[self._update_addon_stats(addon[ATTR_SLUG]) for addon in started_addons]
)
self.hass.data[DATA_ADDONS_STATS] = dict(stats_data)
self.hass.data[DATA_ADDONS_CHANGELOGS] = dict(
await asyncio.gather(
*[self._update_addon_changelog(addon[ATTR_SLUG]) for addon in addons]
*[
self._update_addon_changelog(addon[ATTR_SLUG])
for addon in all_addons
]
)
)
self.hass.data[DATA_ADDONS_INFO] = dict(
await asyncio.gather(
*[self._update_addon_info(addon[ATTR_SLUG]) for addon in addons]
*[self._update_addon_info(addon[ATTR_SLUG]) for addon in all_addons]
)
)

Expand Down

0 comments on commit 3e59687

Please sign in to comment.