mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-14 18:57:10 +08:00
fix(idempotent): 修复幂等处理切面,未设置超时时间的问题
This commit is contained in:
@@ -63,7 +63,7 @@ public class IdempotentAspect {
|
|||||||
public Object around(ProceedingJoinPoint joinPoint, Idempotent idempotent) throws Throwable {
|
public Object around(ProceedingJoinPoint joinPoint, Idempotent idempotent) throws Throwable {
|
||||||
String cacheKey = this.getCacheKey(joinPoint, idempotent);
|
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());
|
throw new IdempotentException(idempotent.message());
|
||||||
}
|
}
|
||||||
// 执行目标方法
|
// 执行目标方法
|
||||||
|
Reference in New Issue
Block a user