diff --git a/src/main/java/com/tiketeer/Tiketeer/domain/purchase/annotation/CheckWaitingQueueAndTokenAop.java b/src/main/java/com/tiketeer/Tiketeer/domain/purchase/annotation/CheckWaitingQueueAndTokenAop.java index 52f0eddc..063f587f 100644 --- a/src/main/java/com/tiketeer/Tiketeer/domain/purchase/annotation/CheckWaitingQueueAndTokenAop.java +++ b/src/main/java/com/tiketeer/Tiketeer/domain/purchase/annotation/CheckWaitingQueueAndTokenAop.java @@ -47,16 +47,17 @@ public Object check(final ProceedingJoinPoint joinPoint) throws Throwable { String[] args = purchaseToken.split(":"); var email = args[0]; var ticketingId = args[1]; + var keyName = "queue::" + ticketingId; validateUser(email); - validateTokenWithRedis(ticketingId, email); + validateTokenWithRedis(keyName, email); try { return joinPoint.proceed(); } catch (Throwable e) { throw e; } finally { - redisService.removeZset("queue::" + ticketingId, email); + redisService.removeZset(keyName, email); } } @@ -76,16 +77,16 @@ private void validateUser(String email) { } } - private void validateTokenWithRedis(String ticketingId, String email) { - var results = redisService.getZSetRankAndScore("queue::" + ticketingId, email).orElseThrow(() -> { - log.error("User does not enter queue (email: {}, ticketing_id: {})", email, ticketingId); + private void validateTokenWithRedis(String keyName, String email) { + var results = redisService.getZSetRankAndScore(keyName, email).orElseThrow(() -> { + log.error("User does not enter queue (queue_name: {}, email: {})", keyName, email); return new UserNotExistInQueueException(); }); var rank = results.getFirst(); if (rank >= 10) { log.error( - "User is not in purchasing order. (email: \" + email + \", ticketing_id: \" + ticketingId + \")\""); + "User is not in purchasing order. (queue_name: {}, email: {})", keyName, email); throw new UserNotInOrderException(); } }