|
@@ -91,10 +91,14 @@ public class ContentUnderstandingPipelineTaskConsumer implements RocketMQListene
|
|
return ConsumeResult.SUCCESS;
|
|
return ConsumeResult.SUCCESS;
|
|
}
|
|
}
|
|
//相同视频跳过
|
|
//相同视频跳过
|
|
|
|
+ boolean skipSameVideo = false;
|
|
if (Objects.nonNull(sameVideoUnderstandingSkipSeconds) && sameVideoUnderstandingSkipSeconds > 0) {
|
|
if (Objects.nonNull(sameVideoUnderstandingSkipSeconds) && sameVideoUnderstandingSkipSeconds > 0) {
|
|
|
|
+ skipSameVideo = true;
|
|
|
|
+ }
|
|
|
|
+ if (skipSameVideo) {
|
|
String key = String.format(SAME_VIDEO_SKIP_KEY, videoId);
|
|
String key = String.format(SAME_VIDEO_SKIP_KEY, videoId);
|
|
- Boolean flag = redisUtil.setNx(key, "1", sameVideoUnderstandingSkipSeconds);
|
|
|
|
- if (Objects.isNull(flag) || !flag) {
|
|
|
|
|
|
+ Boolean hasKey = redisUtil.hasKey(key);
|
|
|
|
+ if (Boolean.TRUE.equals(hasKey)) {
|
|
log.info("相同视频跳过理解 videoId = {} taskId = {} sameVideoUnderstandingSkipSeconds = {}", videoId, taskId, sameVideoUnderstandingSkipSeconds);
|
|
log.info("相同视频跳过理解 videoId = {} taskId = {} sameVideoUnderstandingSkipSeconds = {}", videoId, taskId, sameVideoUnderstandingSkipSeconds);
|
|
String reason = "相同视频跳过理解,时间间隔:" + sameVideoUnderstandingSkipSeconds;
|
|
String reason = "相同视频跳过理解,时间间隔:" + sameVideoUnderstandingSkipSeconds;
|
|
pipelineService.updateTaskResult(taskId, null, reason, videoId, extMap, false);
|
|
pipelineService.updateTaskResult(taskId, null, reason, videoId, extMap, false);
|
|
@@ -140,6 +144,10 @@ public class ContentUnderstandingPipelineTaskConsumer implements RocketMQListene
|
|
dto1.setExtMap(extMap);
|
|
dto1.setExtMap(extMap);
|
|
// 4.按照步骤执行pipeline每一步动作
|
|
// 4.按照步骤执行pipeline每一步动作
|
|
pipelineService.executeTaskTreeNodeBFS(root, dto1);
|
|
pipelineService.executeTaskTreeNodeBFS(root, dto1);
|
|
|
|
+ if (skipSameVideo) {
|
|
|
|
+ String key = String.format(SAME_VIDEO_SKIP_KEY, videoId);
|
|
|
|
+ redisUtil.set(key, "1", sameVideoUnderstandingSkipSeconds);
|
|
|
|
+ }
|
|
return ConsumeResult.SUCCESS;
|
|
return ConsumeResult.SUCCESS;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("Message is failed to be acknowledged, messageId={}", messageId, e);
|
|
log.error("Message is failed to be acknowledged, messageId={}", messageId, e);
|