Bläddra i källkod

new匹配小程序 去除并发 恢复

wangyunpeng 2 veckor sedan
förälder
incheckning
93f19e8f14

+ 6 - 12
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/NewMatchVideoServiceImpl.java

@@ -168,23 +168,17 @@ public class NewMatchVideoServiceImpl implements NewMatchVideoService {
     @Override
     @Override
     public void matchCrawlerVideo() throws InterruptedException {
     public void matchCrawlerVideo() throws InterruptedException {
         List<NewMatchVideo> videos = queryMatchVideosByStatus(NewContentStatusEnum.KIMI_SUCCESS);
         List<NewMatchVideo> videos = queryMatchVideosByStatus(NewContentStatusEnum.KIMI_SUCCESS);
-        if (CollectionUtils.isEmpty(videos)) {
-            return;
-        }
-        for (NewMatchVideo video : videos) {
-            processCrawlerMatchContent(video);
-        }
+        processVideosInParallel(videos,
+                this::processCrawlerMatchContent,
+                newMatchCrawlerVideoPoolExecutor);
     }
     }
 
 
     @Override
     @Override
     public void uploadCrawlerVideo() throws InterruptedException {
     public void uploadCrawlerVideo() throws InterruptedException {
         List<NewMatchVideo> videos = queryMatchVideosByStatus(NewContentStatusEnum.CRAWLER_SUCCESS);
         List<NewMatchVideo> videos = queryMatchVideosByStatus(NewContentStatusEnum.CRAWLER_SUCCESS);
-        if (CollectionUtils.isEmpty(videos)) {
-            return;
-        }
-        for (NewMatchVideo video : videos) {
-            processUploadCrawlerVideo(video);
-        }
+        processVideosInParallel(videos,
+                this::processUploadCrawlerVideo,
+                newUploadCrawlerVideoPoolExecutor);
     }
     }
 
 
     private void processKimiMatchContent(NewMatchVideo newMatchVideo) {
     private void processKimiMatchContent(NewMatchVideo newMatchVideo) {