Configs without database rows read and validate only; imports run off the event loop (#874)

The base import for a config with no sections now reads its file once, reports a 0-byte file as empty, treats a
missing file as the defaults, and records success or failure itself (sending the failure Event on request).  The
per-config overrides that only set successful_import are removed.

wrolpi.yaml and the downloader settings import in a thread at startup (import_file_configs), and the Import, Save
and backup Import buttons run their config work in a thread.

The pre-diff import path (import_decision, record_import_version) has no callers left and is removed.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lrnselfreliance 2026-10-25 15:17:18 -06:00 • committed by Roland
parent ee10b34b15
commit c3e25b84d6
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
12 changed files with 251 additions and 145 deletions

View file

@ -418,10 +418,6 @@ class ArchiveDownloaderConfig(ConfigFile):
"""Get the custom user agent, or None for system default."""
return self._config.get('user_agent')
def import_config(self, file: pathlib.Path = None, send_events=False):
super().import_config(file, send_events)
self.successful_import = True
# Global instance for archive downloader config
ARCHIVE_DOWNLOADER_CONFIG: ArchiveDownloaderConfig = ArchiveDownloaderConfig()

View file

@ -26,11 +26,6 @@ class FlasherConfig(ConfigFile):
)
validator = FlasherConfigValidator
def import_config(self, file=None, send_events=False):
super().import_config(file, send_events)
# YAML-only config (no database); a successful read is a successful import.
self.successful_import = True
@property
def configurations(self) -> List[dict]:
return list(self._config.get('configurations', []))

View file

@ -105,7 +105,6 @@ def import_catalog_config():
config = get_catalog_config()
if config.get_file().is_file():
config.import_config()
config.successful_import = True
seed_catalog_defaults(config)

View file

@ -22,10 +22,6 @@ class MapPinsConfig(ConfigFile):
)
validator = MapPinsConfigValidator
def import_config(self, file=None, send_events=False):
super().import_config(file, send_events)
self.successful_import = True
@property
def pins(self) -> List[dict]:
return list(self._config.get('pins', []))

View file

@ -909,10 +909,6 @@ class VideoDownloaderConfig(ConfigFile):
def strict_codecs(self, value: bool):
self.update({**self._config, 'strict_codecs': value})
def import_config(self, file: pathlib.Path = None, send_events=False):
super().import_config(file, send_events)
self.successful_import = True
VIDEOS_DOWNLOADER_CONFIG: VideoDownloaderConfig = VideoDownloaderConfig()
TEST_VIDEOS_DOWNLOADER_CONFIG: VideoDownloaderConfig = None