From 2f68e5600f0b60d6f8d170f4536e1fc410662ea7 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期二, 01 七月 2025 11:14:39 +0800 Subject: [PATCH] 视频es处理通过mq异步执行 --- framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoEsServiceImpl.java | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoEsServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoEsServiceImpl.java index 7d9a4d8..3823ce3 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoEsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoEsServiceImpl.java @@ -108,7 +108,6 @@ } // 2. 澶氱嚎绋嬫煡璇㈣棰戞暟鎹紝鏋勫缓鏂囨。瀵硅薄 Long totalVideo = new LambdaQueryChainWrapper<>(videoMapper) - .eq(Video::getStatus, VideoStatusEnum.PUBLISHED.getValue()) .count(); int totalThreads = (int) Math.ceil((double) totalVideo / 200); // 璁$畻闇�瑕佸灏戜釜绾跨▼ CountDownLatch latch = new CountDownLatch(totalThreads); @@ -155,15 +154,17 @@ } @Override - public void addOrUpdateDocument(String indexName, String id, Object data) { - indexName = this.getIndexFullName(indexName); - IndexRequest request = new IndexRequest(indexName); - request.id(id).source(data); - try { - client.index(request, RequestOptions.DEFAULT); - } catch (IOException e) { - throw new RuntimeException("es鏂囨。娣诲姞/淇敼澶辫触", e); - } + public void addOrUpdateDocument(Object data) { + VideoIndex videoIndex = (VideoIndex) data; + esVideoIndexRepository.save(videoIndex); +// indexName = this.getIndexFullName(indexName); +// IndexRequest request = new IndexRequest(indexName); +// request.id(id).source(data); +// try { +// client.index(request, RequestOptions.DEFAULT); +// } catch (IOException e) { +// throw new RuntimeException("es鏂囨。娣诲姞/淇敼澶辫触", e); +// } } @Override -- Gitblit v1.8.0