diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/common/redisson/RedissonDistributedLockAop.java b/src/main/java/kr/co/studyhubinu/studyhubserver/common/redisson/RedissonDistributedLockAop.java index 82dd00c..afffc25 100644 --- a/src/main/java/kr/co/studyhubinu/studyhubserver/common/redisson/RedissonDistributedLockAop.java +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/common/redisson/RedissonDistributedLockAop.java @@ -21,6 +21,8 @@ public class RedissonDistributedLockAop { private final RedissonClient redissonClient; + private static final int LOCK_WAIT_TIME = 10; + private static final int LOCK_LEASE_TIME = 3; @Around("@annotation(kr.co.studyhubinu.studyhubserver.common.redisson.RedissonDistributedLock)") public Object around(ProceedingJoinPoint joinPoint) throws Throwable { @@ -35,7 +37,7 @@ public Object around(ProceedingJoinPoint joinPoint) throws Throwable { Object result; boolean available = false; try { - available = lock.tryLock(10, 3, TimeUnit.SECONDS); + available = lock.tryLock(LOCK_WAIT_TIME, LOCK_LEASE_TIME, TimeUnit.SECONDS); if (!available) { log.warn("Redisson GetLock Timeout {}", field); throw new StudyApplyLockAcquisitionException(); diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/domain/implementations/StudyPostApplyEventPublisher.java b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/domain/implementations/StudyPostApplyEventPublisher.java index c7072a6..f19bf78 100644 --- a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/domain/implementations/StudyPostApplyEventPublisher.java +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/domain/implementations/StudyPostApplyEventPublisher.java @@ -3,7 +3,6 @@ import kr.co.studyhubinu.studyhubserver.common.redisson.RedissonDistributedLock; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.redisson.api.RedissonClient; import org.springframework.stereotype.Component; @Component @@ -11,9 +10,7 @@ @Slf4j public class StudyPostApplyEventPublisher { - private final RedissonClient redissonClient; private final StudyPostWriter studyPostWriter; - private final StudyPostReader studyPostReader; @RedissonDistributedLock(hashKey = "'apply'", field = "#studyPostId") public void acceptApplyEventPublish(Long studyPostId) { diff --git a/src/test/java/kr/co/studyhubinu/studyhubserver/studypost/domain/implementations/StudyPostApplyEventPublisherTest.java b/src/test/java/kr/co/studyhubinu/studyhubserver/studypost/domain/implementations/StudyPostApplyEventPublisherTest.java index 79dabe8..d5c6937 100644 --- a/src/test/java/kr/co/studyhubinu/studyhubserver/studypost/domain/implementations/StudyPostApplyEventPublisherTest.java +++ b/src/test/java/kr/co/studyhubinu/studyhubserver/studypost/domain/implementations/StudyPostApplyEventPublisherTest.java @@ -16,6 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @SpringBootTest +@Disabled class StudyPostApplyEventPublisherTest { @Autowired