Skip to content

限制视频任务轮询重试次数与总时长 - #1408

Merged
yokowu merged 1 commit into
mainfrom
fix-video-retry-limit
Oct 14, 2026
Merged

yokowu merged 1 commit into
mainfrom
fix-video-retry-limit

Conversation

@yokowu

@yokowu yokowu commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

视频任务查询持续返回 HTTP 404 等错误时,原实现会一直轮询。现在连续处理失败最多 10 次,失败后从 30 秒逐步退避至 5 分钟,任务自创建起超过 30 分钟后停止自动轮询。

失败计数保存到数据库,正常查询到运行中时清零,服务重启后继续使用已有计数。达到次数或时间限制后,任务转为 unknown,未结算计费保持待核查,并记录 provider_poll_exhausted 或 provider_poll_timeout;供应商明确返回失败时仍正常释放计费。服务关闭导致的取消不增加失败次数。

新增迁移 000022_video_poll_retry_limit,同步 schema、sqlc 生成结果和设计说明。上线时需先应用迁移;历史已超时的任务会在后续轮询中停止自动重试。

验证已通过:

  • PostgreSQL 视频模块与迁移测试:go test ./internal/videogen/... ./migrations -count=1。
  • PostgreSQL 视频模块竞态检查:go test -race ./internal/videogen/... -count=1。
  • 常规全量测试(未启用外部服务集成用例):go test ./...。
  • go vet ./...、make sqlc-check 和 git diff --check。

完整数据库集成测试尚未通过:应用层的 TestAuditIntegration、TestBillingIntegration 初始化计费时报 no rows in result set,TestResourceIntegration 缺少 MONKEYAI_S3_ENDPOINT。已在未包含本次修改的 main(1b70fb15)复现相同失败。

@yokowu
yokowu merged commit eb2851a into main Oct 14, 2026
1 check passed
@yokowu
yokowu deleted the fix-video-retry-limit branch October 14, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant