Harden health probe against false restarts
Probe mpv-version (always present) instead of time-pos, which live streams with caching off can report unavailable while playing fine — that produced false unhealthy verdicts. Also require 3 consecutive misses (~60s) before force-restarting a hung stream. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -232,8 +232,10 @@ func (d *Daemon) healthLoop(ctx context.Context) {
|
||||
continue
|
||||
}
|
||||
stalls[p.Slot]++
|
||||
if stalls[p.Slot] >= 2 {
|
||||
d.log.Warn("stream stalled, forcing restart", "slot", p.Slot, "camera", p.Name)
|
||||
// Require three consecutive unresponsive probes (~60s) before
|
||||
// forcing a restart, so a brief IPC hiccup never bounces a stream.
|
||||
if stalls[p.Slot] >= 3 {
|
||||
d.log.Warn("stream hung, forcing restart", "slot", p.Slot, "camera", p.Name, "misses", stalls[p.Slot])
|
||||
p.Stop() // Supervise relaunches
|
||||
stalls[p.Slot] = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user