refactor(backend_server.py): if known_clients.yaml not present, call _save_known_clients()

This commit is contained in:
2026-03-05 20:51:53 +01:00
parent f46d27164b
commit efbf99f356

View File

@@ -49,9 +49,9 @@ class BackendServer:
) )
self.clients: dict[str, Client] = {} self.clients: dict[str, Client] = {}
self.known_clients: dict[str, dict[str, str | float]] = (
self._load_known_clients() self.known_clients: dict[str, dict[str, str | float]] = {}
) self.known_clients = self._load_known_clients()
self.message_handlers: dict[ self.message_handlers: dict[
tuple[Category, ActionType], Callable[[Client, Message], None] tuple[Category, ActionType], Callable[[Client, Message], None]
@@ -114,8 +114,7 @@ class BackendServer:
self.logger.warning( self.logger.warning(
"known_clients.yaml not found, creating empty known clients list" "known_clients.yaml not found, creating empty known clients list"
) )
with open("config/known_clients.yaml", "w") as f: self._save_known_clients()
yaml.safe_dump({"known_clients": {}}, f)
except Exception as e: except Exception as e:
self.logger.error(f"Error loading known clients: {e}") self.logger.error(f"Error loading known clients: {e}")
raise raise