Optimize server startup speed, client update caching, and HTTP 304 conditional downloads
CI Test Suite / Run Component Tests & Pipeline Verification (push) Failing after 1m28s

This commit is contained in:
2026-10-02 22:43:18 +02:00
parent fe9d43cab6
commit 9ebfadbe89
5 changed files with 213 additions and 45 deletions
+15 -18
View File
@@ -193,19 +193,24 @@ class StorageEngine:
)
""")
def _ensure_columns(tbl: str, cols: List[Tuple[str, str]]):
try:
existing = {row[1] for row in conn.execute(f"PRAGMA table_info({tbl})").fetchall()}
for col, col_def in cols:
if col not in existing:
conn.execute(f"ALTER TABLE {tbl} ADD COLUMN {col} {col_def}")
except Exception:
pass
# Migrations for license_config
for col, col_def in [
_ensure_columns("license_config", [
("license_id", "TEXT"),
("license_server_url", "TEXT"),
("issued_at", "TEXT"),
("expires_at", "TEXT"),
("license_status", "TEXT DEFAULT 'unlicensed'"),
("features", "TEXT DEFAULT '[]'")
]:
try:
conn.execute(f"ALTER TABLE license_config ADD COLUMN {col} {col_def}")
except sqlite3.OperationalError:
pass
])
# 4. Clients Table
conn.execute("""
@@ -221,7 +226,7 @@ class StorageEngine:
""")
# Migrations for clients table
for col, col_def in [
_ensure_columns("clients", [
("metrics_json", "TEXT DEFAULT '{}'"),
("cpu_percent", "REAL DEFAULT 0.0"),
("memory_percent", "REAL DEFAULT 0.0"),
@@ -229,11 +234,7 @@ class StorageEngine:
("client_version", "TEXT DEFAULT ''"),
("update_status", "TEXT DEFAULT 'up_to_date'"),
("last_update_check", "TEXT")
]:
try:
conn.execute(f"ALTER TABLE clients ADD COLUMN {col} {col_def}")
except sqlite3.OperationalError:
pass
])
# 5. Users Table
conn.execute("""
@@ -249,14 +250,10 @@ class StorageEngine:
""")
# Migrations for users table (2FA)
for col, col_def in [
_ensure_columns("users", [
("totp_secret", "TEXT"),
("totp_enabled", "INTEGER DEFAULT 0")
]:
try:
conn.execute(f"ALTER TABLE users ADD COLUMN {col} {col_def}")
except sqlite3.OperationalError:
pass
])
# Ensure default admin user exists
c = conn.cursor()