fix(idempotent): 修复幂等处理切面,未设置超时时间的问题

This commit is contained in:
sheng_chao
2025-04-24 09:26:42 +00:00
committed by Charles7c
parent 335dc35e2b
commit 5129fea34d

View File

@@ -63,7 +63,7 @@ public class IdempotentAspect {
public Object around(ProceedingJoinPoint joinPoint, Idempotent idempotent) throws Throwable {
String cacheKey = this.getCacheKey(joinPoint, idempotent);
// 如果键已存在,则抛出异常
if (!RedisUtils.setIfAbsent(cacheKey, Duration.ofMillis(idempotent.unit().toMillis(idempotent.timeout())))) {
if (!RedisUtils.setIfAbsent(cacheKey,cacheKey, Duration.ofMillis(idempotent.unit().toMillis(idempotent.timeout())))) {
throw new IdempotentException(idempotent.message());
}
// 执行目标方法