Skip to content

<clean-up> Queue : Cleaning up deprecated DB-related implementation#40

Merged
leonroars merged 3 commits into
mainfrom
cleanup-deprecated-queue-db
Feb 9, 2026
Merged

<clean-up> Queue : Cleaning up deprecated DB-related implementation#40
leonroars merged 3 commits into
mainfrom
cleanup-deprecated-queue-db

Conversation

@leonroars
Copy link
Copy Markdown
Owner

@leonroars leonroars commented Feb 9, 2026

Queue 도메인 DB 구현체 제거 및 Redis 단일 구현체 전환 (Remove Queue Domain DB Implementation and Switch to Redis Only)

작업 내용

Korean

개요
Queue 도메인의 대기열 처리 로직이 Redis로 완전히 이관됨에 따라, 더 이상 사용하지 않는 JPA 기반의 DB 구현체를 제거했습니다.

작업 이유

  • Redis가 대기열 로직의 유일한 구현체가 되었으므로, 불필요한 DB 관련 코드를 유지할 이유가 없습니다.
  • 코드 복잡도를 줄이고 유지보수성을 높이기 위해 사용하지 않는 JPA 엔티티, 리포지토리 및 구현 클래스를 삭제했습니다.

주요 변경 사항

  • TokenJpaEntity, TokenJpaRepository, TokenRepositoryDbImpl, QueueRepository 삭제.
  • TokenRepositoryRedisImpl을 TokenRepository의 기본 구현체로 설정 (@ConditionalOnProperty 제거).
  • application.yml 및 application-test.yml에서 app.queue.provider 설정 제거.
  • QueueServiceIntegrationTest 및 QueueServiceUnitTest가 Redis 환경에서 정상 동작함을 검증.
English

Overview
As the queue processing logic for the Queue domain has been fully migrated to Redis, I have removed the now unused JPA-based DB implementation.

Reason for Change

  • Since Redis is now the sole implementation for the queue logic, there is no need to maintain the legacy DB-related code.
  • To reduce code complexity and improve maintainability, I deleted the unused JPA entities, repositories, and implementation classes.

Key Changes

  • Deleted TokenJpaEntity, TokenJpaRepository, TokenRepositoryDbImpl, and QueueRepository.
  • Set TokenRepositoryRedisImpl as the default implementation for TokenRepository (Removed @ConditionalOnProperty).
  • Removed app.queue.provider configuration from application.yml and application-test.yml.
  • Verified that QueueServiceIntegrationTest and QueueServiceUnitTest function correctly in the Redis environment.

Summary by CodeRabbit

  • Refactor
    • Removed database persistence implementation for queue token management system
    • Eliminated database-backed repository interfaces and entity mapping components
    • Updated application configuration to use default queue provider behavior instead of explicit settings

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

The pull request removes database-backed queue persistence infrastructure, including the QueueRepository domain interface, TokenJpaRepository JPA repository, TokenJpaEntity JPA entity, and TokenRepositoryDbImpl DB implementation class. Configuration files are updated to remove explicit queue provider settings.

Changes

Cohort / File(s) Summary
Domain & JPA Repository Interfaces
src/main/java/com/slam/concertreservation/domain/queue/repository/QueueRepository.java, src/main/java/com/slam/concertreservation/infrastructure/persistence/jpa/TokenJpaRepository.java
Deleted empty domain interface and JPA repository interface with 8 custom query methods for token operations (find, count, expiration checks).
JPA Entity & DB Implementation
src/main/java/com/slam/concertreservation/infrastructure/persistence/jpa/entities/TokenJpaEntity.java, src/main/java/com/slam/concertreservation/infrastructure/persistence/jpa/impl/TokenRepositoryDbImpl.java
Removed JPA entity with domain mapper methods and DB-backed TokenRepository implementation containing 11 methods for token persistence operations.
Redis Implementation
src/main/java/com/slam/concertreservation/infrastructure/persistence/redis/impl/TokenRepositoryRedisImpl.java
Removed @ConditionalOnProperty annotation controlling conditional bean instantiation.
Configuration
src/main/resources/application.yml, src/test/resources/application-test.yml
Removed explicit provider: "REDIS" queue configuration entries.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~55 minutes

Poem

🐰 The rabbit hops through files so neat,
Removing DB—no more a beat!
Redis claims the queue's bright throne,
Let it reign, alone, alone! 🎪

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main objective of removing deprecated DB-based queue implementation and cleanup of unused code in favor of Redis.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cleanup-deprecated-queue-db

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/main/java/com/slam/concertreservation/infrastructure/persistence/redis/impl/TokenRepositoryRedisImpl.java (2)

320-323: ⚠️ Potential issue | 🟡 Minor

Potential NPE: waitingTokenCount is not null-checked unlike countCurrentlyActiveTokens.

ZSetOperations.size() can return null (e.g., key doesn't exist yet). Line 225 already guards against this for the analogous activeTokenCount, but here the raw Long is dereferenced directly.

Proposed fix
     public int countCurrentlyWaitingTokens(Long concertScheduleId) {
         Long waitingTokenCount = tokenScoredSortedSet.size(getTokenRankSortedSetName(concertScheduleId));
-        return waitingTokenCount.intValue();
+        return waitingTokenCount != null ? waitingTokenCount.intValue() : 0;
     }

277-281: ⚠️ Potential issue | 🟡 Minor

Potential NPE: token may be null if the hash entry was removed between scan and get.

Between the cursor yielding a token ID and the subsequent HashOperations.get, the entry could have been evicted (TTL, concurrent expiration). A null guard before accessing token.getExpiredAt() would prevent a runtime NPE.

Proposed fix
                 Token token = tokenHashStorage.get(getTokenHashStorageName(concertScheduleId), tokenId);
 
-                if (token.getExpiredAt() != null && token.getExpiredAt().isBefore(now)) {
+                if (token != null && token.getExpiredAt() != null && token.getExpiredAt().isBefore(now)) {
                     toBeExpiredActivatedTokens.add(token);
                 }

@leonroars leonroars merged commit deb0fa3 into main Feb 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant