|
@@ -553,34 +553,6 @@ public class MatchVideoServiceImpl {
|
|
|
if (existMatchVideoResult(matchVideo)) {
|
|
|
return;
|
|
|
}
|
|
|
- String lockKey = String.format(UPLOAD_CRAWLER_LOCK_KEY, matchVideo.getContentId());
|
|
|
- String lockValue = UUID.randomUUID().toString();
|
|
|
- boolean lock = redisLock.tryLock(lockKey, lockValue, 20, TimeUnit.MINUTES);
|
|
|
- if (lock) {
|
|
|
- boolean res = crawlerVideoService.uploadCrawlerVideo(matchVideo.getContentId(), matchVideo.getFlowPoolLevel());
|
|
|
- if (res) {
|
|
|
- successMatchVideo(matchVideo);
|
|
|
- log.info("uploadCrawlerVideo success contentId={}", matchVideo.getContentId());
|
|
|
- } else {
|
|
|
- log.info("uploadCrawlerVideo fail contentId={}", matchVideo.getContentId());
|
|
|
- //上传失败记录
|
|
|
- String countKey = String.format(UPLOAD_CRAWLER_FAIL_COUNT_KEY, matchVideo.getContentId());
|
|
|
- Integer count = (Integer) redisTemplate.opsForValue().get(countKey);
|
|
|
- if (count != null && count >= 3) {
|
|
|
- LarkRobotUtil.sendMessage("crawlerVideoService uploadCrawlerVideo fail contentId=" + matchVideo.getContentId());
|
|
|
- log.error("crawlerVideoService uploadCrawlerVideo fail contentId={}", matchVideo.getContentId());
|
|
|
- //更新状态为失败
|
|
|
- failMatchVideo(matchVideo);
|
|
|
- } else {
|
|
|
- if (count == null) {
|
|
|
- redisTemplate.opsForValue().set(countKey, 1, 3, TimeUnit.DAYS);
|
|
|
- } else {
|
|
|
- redisTemplate.opsForValue().set(countKey, count + 1, 3, TimeUnit.DAYS);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- redisLock.unlock(lockKey, lockValue);
|
|
|
- }
|
|
|
} else {
|
|
|
//更新状态为etl执行完成 并更新匹配成功状态
|
|
|
successMatchVideo(matchVideo);
|