pipeline_monitor: 2-sec wait перед restore — fix overlay loss race

Bug: restore триггерился сразу после detected "ZMQ ping success", но
filter graph внутри ffmpeg ещё в startup phase — accepts ZMQ commands
но overlay add не fully apply'ются. Часть overlays lost silently.

Симптом: monitor logs "restore_done overlays=6", но pipeline ZMQ probe
показывает filter имеет только 2-3 overlays. Grafana / alerts_chat /
frigate event overlays отсутствуют → user sees пустые cells / strip.

Fix: asyncio.sleep(2.0) перед re-pushing layout + overlays. Pipeline
filter всегда успевает finish init за 2 sec (verified повторными
restart tests).

Cost: 2-sec задержка между detect + visible restore. Acceptable —
total recovery time pipeline crash → fully visible на TV ≈ 5-7 sec.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gx
2026-05-24 08:06:40 +01:00
parent 6081e33e5a
commit 110b77899f
@@ -109,6 +109,11 @@ class PipelineMonitor:
return
client = self.dispatcher._client(inst)
# Pipeline filter может быть ещё в startup — ZMQ может отвечать но
# filter graph не полностью инициализирован. Wait 2 sec чтобы overlays
# accepted reliably.
await asyncio.sleep(2.0)
# 1. Layout (set_layout уже sent в _check_instance — pipeline restored к
# нему. Просто apply ещё раз чтобы быть consistent.)
layout = await self.state.get_layout(instance) or inst.default_layout