mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-14 18:01:20 +08:00
5a25298263
Three changes to make TTS (and all model downloads) more reliable: 1. download.ts: add retry with exponential backoff (3 retries), socket and response timeouts, redirect loop protection, and specific HTTP 403/429 (rate limit) error messages. This fixes the primary failure mode: GitHub Releases rate-limiting model downloads at scale. 2. tts/manager.ts: add file-level locking (.lock files) for model and voice downloads to prevent concurrent processes from racing on the same .tmp file. The lock is stale-checked after 5 minutes. 3. tts/synthesize.ts: increase hasPythonPackage timeout from 10s to 30s (ONNX runtime cold import exceeds 10s on constrained machines), and set maxBuffer to 10 MB (ONNX prints verbose warnings that can exceed the 1 MB default, killing the subprocess). The download retry also benefits whisper (transcribe) and background-removal commands which share the same download utility. PostHog data: TTS failure rate hit 61% on June 2 when usage spiked 3x.