fix(task): 解决原位替换模式下旧映射残留问题

- 在插入新映射前先删除已存在的旧映射记录
- 添加日志记录以便追踪旧映射删除操作
- 确保轮询服务能够正确处理最新的任务渲染作业映射关系
This commit is contained in:
2026-02-06 21:25:51 +08:00
parent a79cbe4f84
commit d286ecb4da

View File

@@ -722,6 +722,12 @@ public class TaskTaskServiceImpl implements TaskService {
// 写入mapping表,供轮询服务处理 // 写入mapping表,供轮询服务处理
try { try {
// 原位替换模式下可能已有旧映射,先删除再插入
TaskRenderJobMappingEntity existingMapping = taskRenderJobMappingMapper.selectByTaskId(taskId);
if (existingMapping != null) {
taskRenderJobMappingMapper.deleteById(existingMapping.getId());
log.info("[灰度测试] 已删除旧mapping, taskId: {}, oldRenderJobId: {}", taskId, existingMapping.getRenderJobId());
}
TaskRenderJobMappingEntity mapping = new TaskRenderJobMappingEntity(); TaskRenderJobMappingEntity mapping = new TaskRenderJobMappingEntity();
mapping.setTaskId(taskId); mapping.setTaskId(taskId);
mapping.setRenderJobId(response.getJobId()); mapping.setRenderJobId(response.getJobId());