fix: rollback must restore AudioConfig period/rate + LATENCY_PROFILES
CI / test (push) Has been cancelled
CI / test (push) Has been cancelled
The profile change rollback only restored audio_sys.config.profile to old_key, but my earlier fix had started syncing period/rate to AudioConfig BEFORE start_jack(). This meant the rollback's start_jack() still used the NEW period/rate (via latency_profile) because self.period was never reverted — the same failing config was retried and failed again. Fix: capture old_period, old_rate, and old LATENCY_PROFILES['custom'] entry before applying the new profile, then restore all of them in the rollback path.
This commit is contained in:
+12
-1
@@ -1674,6 +1674,10 @@ class WebServer:
|
||||
return {"ok": True, "profile": effective_key, "restarted": False}
|
||||
|
||||
# ── Apply new profile on the fly ─────────────────────────
|
||||
# Capture old values for rollback
|
||||
old_period = audio_sys.config.period
|
||||
old_rate = audio_sys.config.rate
|
||||
old_entry = LATENCY_PROFILES.get("custom")
|
||||
# Update AudioConfig — store named overrides inline in profile key
|
||||
audio_sys.config.profile = effective_key
|
||||
|
||||
@@ -1719,8 +1723,15 @@ class WebServer:
|
||||
ok = await loop.run_in_executor(None, partial(audio_sys.start_jack, timeout=15))
|
||||
audio_sys.config.auto_connect = saved_auto_connect
|
||||
if not ok:
|
||||
# Rollback on failure
|
||||
# Rollback on failure — restore AudioConfig fields too
|
||||
audio_sys.config.profile = old_key
|
||||
audio_sys.config.period = old_period
|
||||
audio_sys.config.rate = old_rate
|
||||
# Restore the old LATENCY_PROFILES entry
|
||||
if old_entry is not None:
|
||||
LATENCY_PROFILES["custom"] = old_entry
|
||||
elif "custom" in LATENCY_PROFILES:
|
||||
del LATENCY_PROFILES["custom"]
|
||||
logger.warning("JACK restart failed — attempting rollback to %s", old_key)
|
||||
ok = await loop.run_in_executor(None, partial(audio_sys.start_jack, timeout=15))
|
||||
if jack_client:
|
||||
|
||||
Reference in New Issue
Block a user