fix(media): 清理旧 rendition 并确保失败状态落库
This commit is contained in:
1 parent
5d1a157085
commit
91b621fe75
9 files changed
+226
-35
No files matched your search
@@ -25705,3 +25705,49 @@ $ mvn -pl fruitshorts-admin-api -am test
|
||||
解读:非法/未绑定媒资拒绝、合法 URL 自动绑定、claim 跳过日志、
|
||||
进度上报、重复触发幂等与重启僵尸收口全部通过。
|
||||
|
||||
## 2026-10-22 rendition 唯一键冲突与失败落库
|
||||
|
||||
- 分支:`feature/fix-transcode-rendition-upsert`
|
||||
- 基线:`develop` / `origin/develop` = `5d1a157`
|
||||
- 计划:`docs/plans/2026-10-22-transcode-rendition-upsert.md`
|
||||
|
||||
运行时证据显示同分集复用新媒资时旧 rendition 未删除,触发
|
||||
`uk_rendition(episode_id, quality, format)`;异常后任务停留在 RUNNING。
|
||||
|
||||
### 实现
|
||||
|
||||
- `TranscodeService.succeed` 在同一事务内删除:
|
||||
`(media_asset_id = 本次媒体 OR episode_id = 本次分集)` 的旧 rendition,
|
||||
再插入本次产物。
|
||||
- `media_thumbnail` 表没有 media_asset_id 列,因此按 episode_id 删除旧行后重新插入;
|
||||
覆盖 sprite/VTT 时间轴记录,避免同集唯一键冲突。
|
||||
- 新增 `failFinal`:主流程异常立即写 status=FAILED、截断后的 error_msg、
|
||||
finished_at,不修改 progress。
|
||||
- worker 对 failFinal 与媒资失败状态写入分别 catch,失败时打印 ERROR 堆栈,不让异常逃逸。
|
||||
- 错误截断同时保留头部和尾部关键信息,长度 <= 500。
|
||||
|
||||
### 测试
|
||||
|
||||
```text
|
||||
$ mvn -pl fruitshorts-transcode-worker -am \
|
||||
-Dtest=TranscodeClaimAndStorageTest,TranscodeServiceTriggerTest,TranscodeWorkerTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false test
|
||||
[INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
```
|
||||
|
||||
### 最终门禁
|
||||
|
||||
```text
|
||||
$ mvn -q -DskipTests=false test \
|
||||
-pl fruitshorts-module-media,fruitshorts-transcode-worker,fruitshorts-admin-api -am
|
||||
(退出码 0,BUILD SUCCESS)
|
||||
```
|
||||
|
||||
解读:同分集不同 media_asset_id 的旧 rendition 会被清理,thumbnail 不重复,
|
||||
插入异常后任务最终 FAILED 且错误非空;现有认领、worker 与查询测试全部通过。
|
||||
|
||||
提交:`fix(media): 清理旧 rendition 并确保失败状态落库`(提交号见最终回执)。
|
||||
|
||||
Reference in new issue
Block a user