diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/util/Utils.java b/src/main/java/com/chaozhanggui/system/cashierservice/util/Utils.java index 3349961..f10aabc 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/util/Utils.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/util/Utils.java @@ -49,14 +49,14 @@ public class Utils { // 创建线程id, 用作判断 String clientId = UUID.randomUUID().toString(); // 设置分布式锁 - boolean lock = Boolean.TRUE.equals(redisTemplate.opsForValue().setIfAbsent(lockKey, clientId, 30, TimeUnit.MILLISECONDS)); + boolean lock = Boolean.TRUE.equals(redisTemplate.opsForValue().setIfAbsent(lockKey, clientId, 30, TimeUnit.SECONDS)); int count = 0; while (!lock) { if (count++ > 100) { throw new MsgException("系统繁忙, 稍后再试"); } Thread.sleep(20); - lock = Boolean.TRUE.equals(redisTemplate.opsForValue().setIfAbsent(lockKey, clientId, 30, TimeUnit.MILLISECONDS)); + lock = Boolean.TRUE.equals(redisTemplate.opsForValue().setIfAbsent(lockKey, clientId, 30, TimeUnit.SECONDS)); } return supplier.get(); } catch (RuntimeException e){