From 0c405ae7d4af29b1797e7e176383f19e79224c9d Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Thu, 4 Jun 2026 13:02:23 +0000 Subject: [PATCH] fix(growing): read GROWING_ENABLED from env at record time + drop dead const Second half of the growing-never-engages bug. start() decided growing via the module-level const GROWING_ENABLED (captured false at standby boot) and referenced the now-removed GROWING_SMB_MOUNT const (ReferenceError, silently swallowed). Both made growingActive=false, so every growing record produced HEVC/S3 instead of XDCAM HD422 MXF. Now reads process.env.GROWING_ENABLED + growingSmbConfig().mount fresh at record start. --- services/capture/src/capture-manager.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/services/capture/src/capture-manager.js b/services/capture/src/capture-manager.js index 89baa72..1f022a7 100644 --- a/services/capture/src/capture-manager.js +++ b/services/capture/src/capture-manager.js @@ -17,9 +17,9 @@ const PRE_ROLL_SECONDS = parseInt(process.env.PRE_ROLL_SECONDS || (_standbyMode // Growing-files mode: writes the master to a local SMB-backed share that the // editor can mount, instead of streaming to S3 in real time. The promotion // worker uploads the finalized file to S3 after the recording stops. -// Toggled per-recorder via `GROWING_ENABLED=true` on the capture container -// (see routes/recorders.js where the env is composed). -const GROWING_ENABLED = process.env.GROWING_ENABLED === 'true'; +// Toggled per-recorder via `GROWING_ENABLED=true`, delivered per-session on +// /capture/start (read fresh from process.env at record time in start(), NOT +// cached here — standby sidecars boot with it false). const GROWING_PATH = process.env.GROWING_PATH || '/growing'; // Approach A: when a CIFS source is supplied, this (privileged) container mounts @@ -1001,8 +1001,14 @@ exit "$BMXRC" // Approach A: if a CIFS source is configured, mount it now. A mount failure // is non-fatal — we fall back to S3 streaming so the recording is never // lost. - let growingActive = GROWING_ENABLED; - if (growingActive && GROWING_SMB_MOUNT) { + // Read growing flags FRESH from env at record time — standby sidecars boot + // with GROWING_ENABLED=false and receive the real value per-session over + // /capture/start (capture.js sets process.env before this runs). The old + // module-level `const GROWING_ENABLED` / `GROWING_SMB_MOUNT` captured the + // empty boot values, so growing never engaged and every "growing" record + // silently produced HEVC/S3 instead of the XDCAM HD422 MXF. + let growingActive = process.env.GROWING_ENABLED === 'true'; + if (growingActive && growingSmbConfig().mount) { if (!mountGrowingShare()) growingActive = false; // fall back to S3 } // Growing master is always MXF OP1a / XDCAM HD422 written by raw2bmx (the