mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-15 04:40:40 -07:00
* fix: add asyncio.Lock to prevent concurrent CUDA downloads The startup auto-update task and the manual download endpoint can both invoke download_cuda_binary() concurrently. Without mutual exclusion, both coroutines write to the same temp file path, corrupting the download. The progress-manager status check is a TOCTOU race because the status is not set until after several synchronous checks complete. Add a module-level asyncio.Lock acquired at the top of download_cuda_binary() so only one download can proceed at a time. * fix: fast-reject duplicate CUDA download when lock is held Address CodeRabbit review feedback: check _download_lock.locked() before awaiting the lock so concurrent callers return immediately instead of queueing behind the first download. This prevents the route handler from returning "started" to multiple callers when only one download actually proceeds.