openvibers/openvibe.media Commits

Clips: size the encoder queue wait for bulk backlogs (5min -> 30min)

OP OpenVibers committed 18 Aug 2026 · a4fd406f59 · 1 file, +5 −2

Re-cutting 12 clips at 2 concurrent, each taking 1-3 minutes on a loaded box,
left the tail queued past the old 5-minute limit — so seven were written off as
'encoder busy for over 300s' despite nothing being wrong with them.

Cutting is a background job with no deadline; waiting costs nothing, whereas
giving up marks a perfectly good clip broken.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xw6Sf5zzSALw8m93XNu5JE

Changes

ddiff --git a/server/vod/clip-cutter.js b/server/vod/clip-cutter.js
iindex ce9f87d..8549942 100644
---- a/server/vod/clip-cutter.js
++++ b/server/vod/clip-cutter.js
@@@ -19,8 +19,11 @@ const CLIPS_DIR = path.resolve(config.vod.clipsPath);
// alone but several times that when encodes overlap. Three at once on a 4-core box that
// also runs live x264 and whisper is how clips ended up timing out in batches.
const MAX_CONCURRENT = parseInt(process.env.CLIP_MAX_CONCURRENT_FFMPEG || '2', 10);
--// How long a cut will queue for a free encoder slot before giving up.
--const QUEUE_WAIT_MS = parseInt(process.env.CLIP_QUEUE_WAIT_MS || '300000', 10);
++// How long a cut will queue for a free encoder slot before giving up. Sized for a BULK
++// backlog, not a single request: re-cutting 12 clips at 2 concurrent, each taking 1-3
++// minutes on a loaded box, left the tail waiting well past the old 5 minutes and they
++// were written off as failed. This is a background job, so waiting costs nothing.
++const QUEUE_WAIT_MS = parseInt(process.env.CLIP_QUEUE_WAIT_MS || '1800000', 10);
let _active = 0;
function _ffprobe(file) {