Why I don't automatically retry timed-out AI video requests
说明与用途
当视频生成请求超时时,系统在调用外部 API 前记录提交标记,以防止重复付费任务并将不确定的工作转交人工审核。
问题
When a video generation request times out, retrying can unintentionally create duplicate paid tasks because the provider may already be rendering the original request.
结果
By recording a submission marker before external calls and distinguishing job states, the workflow avoids duplicate paid tasks, reduces unnecessary retries, and provides clear paths for manual review and credit restoration.
工作流
- Record a submission timestamp before calling the generation API
- If no submission marker and no provider ID, claim the job, record the attempt, then submit
- If a provider ID exists, query that existing task
- If a submission marker exists but no provider ID, hold the job for support review
- If an output URL is already recorded, continue processing or saving that video
- For failed storage, record source video URL to resume from existing output
- Apply bounded retries to the soundtrack step and fall back to silent footage if exhausted
- Restore user credits on confirmed generation failure, reserve ambiguous submissions for investigation
证据
The database updates are conditional, and processing uses a short lease so overlapping workers don't casually pick up the same job.
If the worker crashes after writing the marker but before sending the request, the job also ends up waiting for review.
A provider-side idempotency key would be a better way to close that gap.
- 记录日期: 2026-11-02T03:58:47.494Z