Cache existence of addon paths (#4944)

* Cache existence of addon paths

* Always update submodules

* Switch to an always cached model

* Cache on store addon only

* Fix tests

* refresh_cache to refresh_path_cache

* Fix name change in test

* Move logic into StoreManager
This commit is contained in:
Mike Degatano
2024-03-15 11:43:26 -04:00
committed by GitHub
parent 2148de45a0
commit a8af04ff82
10 changed files with 157 additions and 35 deletions

View File

@@ -77,15 +77,20 @@ class AddonManager(CoreSysAttributes):
async def load(self) -> None:
"""Start up add-on management."""
tasks = []
# Refresh cache for all store addons
tasks: list[Awaitable[None]] = [
store.refresh_path_cache() for store in self.store.values()
]
# Load all installed addons
for slug in self.data.system:
addon = self.local[slug] = Addon(self.coresys, slug)
tasks.append(self.sys_create_task(addon.load()))
tasks.append(addon.load())
# Run initial tasks
_LOGGER.info("Found %d installed add-ons", len(tasks))
_LOGGER.info("Found %d installed add-ons", len(self.data.system))
if tasks:
await asyncio.wait(tasks)
await asyncio.gather(*tasks)
# Sync DNS
await self.sync_dns()