mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-12 19:56:29 +00:00
Avoid reading add-ons twice unnecessarily (#5846)
So far a store reload lead to a reload of all add-ons twice, usually causing two messages in quick succession: ``` 2025-04-25 17:01:05.058 INFO (MainThread) [supervisor.store] Loading add-ons from store: 91 all - 0 new - 0 remove 2025-04-25 17:01:05.058 INFO (MainThread) [supervisor.store] Loading add-ons from store: 91 all - 0 new - 0 remove ``` This is because when repository changes are detected, `reload()` calls `load()` which then calls `update_repositories()` which ends up calling `_read_addons()`, while `reload()` itself calls `_read_addons()` after `load()` as well. One way to fix this would be to simply remove the `_read_addons()` call in `reload()`. However, it seems the `update_repositories()` call (via `load()`) is not necessary at all, as we don't add new store repositories in `reload()`, and we already made sure the built-ins are present on startup. So simply call `data.update()` to update the store data cache, as it was the case before #2225. There is no apparent reason documented why `data.update()` was changed to a `load()` call. It might be to ensure regularly that built-in repositories are still in the list of store repositories. But this type of regular invariant check is often harmful as it might hide bugs in other places. Supervisor will still call `update_repositories()` in `load()` to ensure all built-in repositories are present, just in case the local configuration file got modified or corrupted.
This commit is contained in:
parent
88087046de
commit
8e714072c2
@ -116,7 +116,7 @@ class StoreManager(CoreSysAttributes, FileConfiguration):
|
||||
)
|
||||
|
||||
# read data from repositories
|
||||
await self.load()
|
||||
await self.data.update()
|
||||
await self._read_addons()
|
||||
|
||||
@Job(
|
||||
|
Loading…
x
Reference in New Issue
Block a user