From f1fce0806b149606369491be5d54a4684cd5429b Mon Sep 17 00:00:00 2001 From: qiuyt Date: Mon, 20 Jan 2025 17:15:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=89=E5=8F=96=E5=85=B3=E8=81=94=E5=85=B3?= =?UTF-8?q?=E7=B3=BB=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/glxp/api/service/collect/RelCodeBatchService.java | 2 +- src/main/java/com/glxp/api/util/redis/RedisDelayedQueue.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java b/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java index d130e2e1..09c41ad7 100644 --- a/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java +++ b/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java @@ -766,7 +766,7 @@ public class RelCodeBatchService extends ServiceImpl().eq("curCode",code) ); if(Objects.isNull(relCodeBatch)){ - redisDelayedQueue.addTaskToQueue(code+"&&&"+erpId,relCodeDelaySeconds); + redisDelayedQueue.addTaskToQueue(code+"&&&"+erpId,relCodeDelaySeconds,"rel_code_queue"); }else { log.error("有关联关系了此码==="+code); } diff --git a/src/main/java/com/glxp/api/util/redis/RedisDelayedQueue.java b/src/main/java/com/glxp/api/util/redis/RedisDelayedQueue.java index 3f57548d..09e9c76d 100644 --- a/src/main/java/com/glxp/api/util/redis/RedisDelayedQueue.java +++ b/src/main/java/com/glxp/api/util/redis/RedisDelayedQueue.java @@ -15,9 +15,9 @@ public class RedisDelayedQueue { // 将任务加入延时队列 - public void addTaskToQueue(String taskId, long delaySeconds) { + public void addTaskToQueue(String taskId, long delaySeconds,String queueName) { long timestamp = System.currentTimeMillis() / 1000 + delaySeconds; // 计算任务执行的时间戳 - jedis.zadd("rel_code_queue", timestamp, taskId); // 将任务添加到有序集合,score 为任务的执行时间戳 + jedis.zadd(queueName, timestamp, taskId); // 将任务添加到有序集合,score 为任务的执行时间戳 System.out.println("Task " + taskId + " added to queue with " + delaySeconds + " seconds delay."); }