diff --git a/backend/src/main/java/com/festago/ticketing/infrastructure/sequence/RedisTicketSequence.java b/backend/src/main/java/com/festago/ticketing/infrastructure/sequence/RedisTicketSequence.java index 6d8dabe6c..8b2725523 100644 --- a/backend/src/main/java/com/festago/ticketing/infrastructure/sequence/RedisTicketSequence.java +++ b/backend/src/main/java/com/festago/ticketing/infrastructure/sequence/RedisTicketSequence.java @@ -33,7 +33,7 @@ public int reserve() { @Override public void cancel(int sequence) { - redisTemplate.opsForList().leftPush(key, String.valueOf(sequence)); + redisTemplate.opsForList().rightPush(key, String.valueOf(sequence)); } @Override diff --git a/backend/src/test/java/com/festago/ticketing/infrastructure/sequence/MemoryTicketSequence.java b/backend/src/test/java/com/festago/ticketing/infrastructure/sequence/MemoryTicketSequence.java index a04fc974a..0b7977ed6 100644 --- a/backend/src/test/java/com/festago/ticketing/infrastructure/sequence/MemoryTicketSequence.java +++ b/backend/src/test/java/com/festago/ticketing/infrastructure/sequence/MemoryTicketSequence.java @@ -3,17 +3,17 @@ import com.festago.common.exception.BadRequestException; import com.festago.common.exception.ErrorCode; import com.festago.ticketing.domain.TicketSequence; +import java.util.Deque; import java.util.List; -import java.util.Queue; -import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.LinkedBlockingDeque; import java.util.stream.IntStream; public class MemoryTicketSequence implements TicketSequence { - private final Queue queue; + private final Deque queue; public MemoryTicketSequence(int quantity) { - this.queue = new ArrayBlockingQueue<>(quantity); + this.queue = new LinkedBlockingDeque<>(quantity); List sequences = IntStream.rangeClosed(1, quantity) .boxed() .toList(); @@ -36,7 +36,7 @@ public int reserve() { @Override public void cancel(int sequence) { - queue.offer(sequence); + queue.addFirst(sequence); } @Override