Browse Source

2023-10-25 redis锁修改成存执。

chaiyunlong 2 years ago
parent
commit
1446d113bc

+ 5 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/event/RedisExpiredAndWorkListener.java

@@ -146,6 +146,11 @@ public class RedisExpiredAndWorkListener extends KeyExpirationEventMessageListen
 
             String key = BaseConstants.REDIS_LOCK + ""+beaconStr[1];
             log.info("》》》》》》》》》》》》》》》》》》》》key:"+key);
+            try {
+                Thread.sleep(Long.parseLong((Math.random()*50+50)+""));
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
             if (!redisService.hasKey(key)) {
                 redisService.setCacheObject(key,key,5L, TimeUnit.SECONDS);
                 log.info("》》》》》》》》》》》》》》》》》》》》key:"+redisService.hasKey(key));