Speed up transcoding without overloading the VM, add bulk retry

- nice level 19 -> 10 (was the absolute lowest CPU priority) and cap
  ffmpeg to 6 threads on this 8-core host, leaving headroom for Mongo,
  the *arr stack, and the API itself instead of an unbounded encode.
- Add POST /transcode/queue/retry-failed to re-queue every failed/
  cancelled job at once; label the per-job Retry button with text
  (was icon-only) and clarify in the page copy that failed/cancelled
  jobs never delete the movie — retry just re-queues the same file.
This commit is contained in:
Myron Blair
2026-07-26 21:21:22 -05:00
parent c174ac60b1
commit 4e72f568f3
3 changed files with 33 additions and 6 deletions
+10
View File
@@ -707,6 +707,16 @@ async def retry_job(job_id: str, user: dict = Depends(require_admin)):
return {"ok": True, "job_id": new_job["id"]}
@api.post("/transcode/queue/retry-failed")
async def retry_all_failed(user: dict = Depends(require_admin)):
jobs = await db.transcode_queue.find({"status": {"$in": ["failed", "cancelled"]}}, {"_id": 0}).to_list(500)
retried = 0
for job in jobs:
await _enqueue_transcode(job["movie_id"], job["quality"], triggered_by=job.get("triggered_by", "manual"), content_type=job.get("content_type", "movie"))
retried += 1
return {"ok": True, "retried": retried}
@api.post("/transcode/queue/clear")
async def clear_finished(user: dict = Depends(require_admin)):
res = await db.transcode_queue.delete_many({"status": {"$in": ["done", "failed", "cancelled"]}})