Build1 publisher3 min readPublished
Two timeout numbers, not new code, fixed a nightly job that failed 2-3 mornings a week
An unattended video pipeline on macOS launchd stopped dying overnight after a startup wait went from 180s to 600s and a download timeout from 90s to 240s. The logic never changed.
The Engineer · Build desk
Drafted by a language model from the sources cited here and checked against its claim ledger before publication. How we use AISend a correction
What happened
- The pipeline chains ComfyUI, FFmpeg and the Freesound API to generate long-form ASMR videos using only free tools.
- The pipeline is scheduled with macOS launchd so it fires at a fixed time every day.
- The author describes the failure mode as the "cold start" problem: you boot the Mac and ComfyUI simply isn't running.
- The ComfyUI startup wait was raised from 180 seconds to 600 seconds.
- The Freesound download timeout was raised from 90 seconds to 240 seconds.
Compiled by The EngineerSomething wrong?How this is made
Why it matters
A developer running an unattended video pipeline on a Mac reported that raising two timeout values took the job from failing two or three mornings a week to running itself [4][5][6]. That is the whole fix worth reading about, because it says the failure was never in the code path: it was in an assumption about how fast a machine wakes up.
The pipeline chains ComfyUI, FFmpeg and the Freesound API to produce long-form ASMR videos, and it is scheduled through macOS launchd to fire at a fixed time each day [1][2]. According to the author's write-up on dev.to, the recurring break was a cold start: you boot the Mac and ComfyUI simply is not running yet [3]. The script waited 180 seconds for it to come up, which is a reasonable number if you are watching a terminal and a bad one if the model backend is doing several minutes of MPS inference on a machine that just resumed [4][13]. The wait went to 600 seconds. The Freesound download timeout went from 90 seconds to 240 [5]. In multiples that is roughly 3.3x and 2.7x the original budgets [7], and it converted a job failing something like 29 to 43 percent of mornings into one the author checks rather than nurses [8][6].
The rest of the design is what makes generous timeouts survivable. launchd fires two slots, 07:00 and 14:00; if the Mac slept through the first, the second is the recovery run [10]. An idempotency guard at the top of the script looks for any directory matching today's date under the output root and, if one exists, logs "already stocked" and exits 0 [9]. That guard is only safe because the output directory lands atomically at the end of a run with the video, thumbnail, youtube.md and still image already in place, so a half-finished run does not leave a decoy directory that suppresses the retry [11]. Longer timeouts plus a retry slot plus an exit-0 guard is a coherent set. Any one of them alone is a worse system.
Observability is one append to coverage.csv per run, with the columns date, theme, duration, sound count, size and status; a successful YouTube upload rewrites the trailing status from OK to OK+uploaded with sed [12]. One line, checked once a morning. The same idempotent structure gives backfill for free: a --date flag fills a missed day, and --still skips launching ComfyUI entirely and remixes audio over an existing image [14].
Two things to watch. First, 600 and 240 are not measurements, they are envelopes around an observed worst case, and worst cases move when a model, a disk or a network path changes; the CSV is the only instrument that will report the drift [12]. Second, the write-up does not describe a lock or overlap guard for a 07:00 run still executing when the 14:00 slot fires [18], and a 600-second wait makes that window wider than it was at 180.
The economic case is separate and thinner: the author's stated motivation was that 30 hand-made videos a month is 60 to 90 hours of work, an attempt that collapsed in two weeks alongside a side job [15], and that keeping ComfyUI and FFmpeg local means no vendor can reprice the pipeline out of existence [16][17]. That claim is untested here. The timeout numbers are not.