提交 b2cb839a 作者: 洪东保

转录文件为空或者太短直接不重试

父级 06afcce4
...@@ -228,29 +228,37 @@ public class FileProcessTask { ...@@ -228,29 +228,37 @@ public class FileProcessTask {
processLogService.log(meetingId,subMeetingId,meetingRecordId + sw.toString()); processLogService.log(meetingId,subMeetingId,meetingRecordId + sw.toString());
// 异常处理 // 异常处理
retryCount++; retryCount++;
if (retryCount > MAX_RETRY) { if (status != null && status == MeetingState.EMPTY.getCode()) {
log.error("达到最大重试次数:meetingId {}", meetingId); meetingInfoMapper.update(null,
//如果是兜底重试,最终还是失败了,设置会议的重试状态为已重试 new LambdaUpdateWrapper<MeetingInfo>()
if (finalRetry) { .eq(MeetingInfo::getMeetingRecordId, meetingRecordId)
meetingInfoMapper.update(null, .set(MeetingInfo::getStatus, status));
new LambdaUpdateWrapper<MeetingInfo>() break;
.eq(MeetingInfo::getMeetingRecordId, meetingRecordId)
.set(MeetingInfo::getStatus, status != null ? status : MeetingState.GENERATE_ERROR.getCode())
.set(MeetingInfo::getGenerateRetry,Boolean.TRUE));
} else {
meetingInfoMapper.update(null,
new LambdaUpdateWrapper<MeetingInfo>()
.eq(MeetingInfo::getMeetingRecordId, meetingRecordId)
.set(MeetingInfo::getStatus, status != null ? status : MeetingState.GENERATE_ERROR.getCode())
);
}
} else { } else {
// 指数退避 if (retryCount > MAX_RETRY) {
try { log.error("达到最大重试次数:meetingId {}", meetingId);
Thread.sleep((long) Math.pow(2, retryCount) * 1000); //如果是兜底重试,最终还是失败了,设置会议的重试状态为已重试
} catch (InterruptedException ie) { if (finalRetry) {
Thread.currentThread().interrupt(); meetingInfoMapper.update(null,
throw new RuntimeException("重试失败", ie); new LambdaUpdateWrapper<MeetingInfo>()
.eq(MeetingInfo::getMeetingRecordId, meetingRecordId)
.set(MeetingInfo::getStatus, status != null ? status : MeetingState.GENERATE_ERROR.getCode())
.set(MeetingInfo::getGenerateRetry, Boolean.TRUE));
} else {
meetingInfoMapper.update(null,
new LambdaUpdateWrapper<MeetingInfo>()
.eq(MeetingInfo::getMeetingRecordId, meetingRecordId)
.set(MeetingInfo::getStatus, status != null ? status : MeetingState.GENERATE_ERROR.getCode())
);
}
} else {
// 指数退避
try {
Thread.sleep((long) Math.pow(2, retryCount) * 1000);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw new RuntimeException("重试失败", ie);
}
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论