app: Don't load apps again

- Only effective once. Second call will skip loading apps.

- Helps with privileged daemon where actions might load apps repeatedly.

Tests:

- Diagnostics/enable/disable for apps bepasty, updates, config, security,
  nextcloud, homeassistant run fine.

- Install/uninstall for bepasty works fine.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
Sunil Mohan Adapa 2025-06-26 18:25:23 -07:00 committed by Joseph Nuthalapati
parent e100c89ecc
commit f2edc6ab2b
No known key found for this signature in database
GPG Key ID: 5398F00A2FA43C35

View File

@ -596,6 +596,9 @@ class EnableState(LeaderComponent):
def apps_init():
"""Create apps by constructing them with components."""
if App.list():
return # Apps have already been initialized
from . import module_loader # noqa # Avoid circular import
for module_name, module in module_loader.loaded_modules.items():
_initialize_module(module_name, module)