refactor(#235): 경매 활성화/만료/카드동기화 배치를 메인앱 Internal API 위임으로 전환 - #12
Conversation
|
Warning Review limit reached
More reviews will be available in 49 minutes and 24 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThree batch tasklets ( ChangesInternal API Delegation Refactor
Sequence DiagramsequenceDiagram
participant BatchScheduler
participant AuctionActivationTasklet
participant MainAuctionLifecycleClient
participant MainApp as Main App Internal API
BatchScheduler->>AuctionActivationTasklet: execute(StepContribution, ChunkContext)
AuctionActivationTasklet->>AuctionActivationTasklet: fetch APPROVED auctions from AuctionRepository
loop per auctionId
AuctionActivationTasklet->>MainAuctionLifecycleClient: activate(auctionId, jobExecutionId)
MainAuctionLifecycleClient->>MainApp: POST /internal/auctions/{id}/activate\nX-Internal-Token, Idempotency-Key
alt 200 success=true, data=true
MainApp-->>MainAuctionLifecycleClient: ApiResponseEnvelope{success:true, data:true}
MainAuctionLifecycleClient-->>AuctionActivationTasklet: true → activatedCount++
else 200 success=true, data=false
MainApp-->>MainAuctionLifecycleClient: ApiResponseEnvelope{success:true, data:false}
MainAuctionLifecycleClient-->>AuctionActivationTasklet: false → skippedCount++
else 4xx
MainApp-->>MainAuctionLifecycleClient: HttpClientErrorException
MainAuctionLifecycleClient-->>AuctionActivationTasklet: RuntimeException → failedCount++
else 5xx (retry ≤3 with backoff)
MainApp-->>MainAuctionLifecycleClient: server error
MainAuctionLifecycleClient-->>AuctionActivationTasklet: RuntimeException after retries → failedCount++
end
end
AuctionActivationTasklet-->>BatchScheduler: RepeatStatus.FINISHED
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
cdkkyj123
left a comment
There was a problem hiding this comment.
@coderabbitai review
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/ARCHITECTURE.md`:
- Around line 280-282: The fenced code block at line 280 in the ARCHITECTURE.md
file is missing a language identifier, which violates the markdownlint MD040
rule. Add the language identifier "text" to the opening fence (change the three
backticks to backticks followed by "text") to properly label the code block and
resolve the linting error.
In `@src/main/java/com/rocketcrew/pocatbatch/client/MainCardSyncClient.java`:
- Around line 52-60: The code currently silently skips all 4xx errors after
handling the specific 409 CARD_SYNC_IN_PROGRESS case, which masks real contract
or deployment issues like 404 or 400 errors. After the if block that checks for
HttpStatus.CONFLICT with CARD_SYNC_IN_PROGRESS (which should continue to skip by
returning), change the handling for all other 4xx errors: instead of logging a
warning and returning, throw an exception to fail fast and prevent the step from
appearing successful when there are actual client errors that need attention.
In
`@src/main/java/com/rocketcrew/pocatbatch/job/auctionactivation/AuctionActivationTasklet.java`:
- Around line 48-56: Both AuctionActivationTasklet and AuctionExpirationTasklet
are masking failures by always returning RepeatStatus.FINISHED even when
exceptions occur during processing. In AuctionActivationTasklet (lines 48-56),
after the loop completes and the aggregated log.info statement executes, add a
check that throws an exception if failedCount is greater than 0 instead of
unconditionally returning RepeatStatus.FINISHED. Apply the identical post-loop
failure escalation fix in AuctionExpirationTasklet (lines 52-60), ensuring that
any accumulated failedCount > 0 causes the step to fail rather than complete
successfully. This preserves the per-item exception aggregation and logging
while properly escalating systemic failures.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4493a56b-784d-49ee-a708-2df99189b793
📒 Files selected for processing (15)
docs/ARCHITECTURE.mddocs/RUNBOOK.mdsrc/main/java/com/rocketcrew/pocatbatch/client/MainAuctionLifecycleClient.javasrc/main/java/com/rocketcrew/pocatbatch/client/MainCardSyncClient.javasrc/main/java/com/rocketcrew/pocatbatch/domain/auction/entity/Auction.javasrc/main/java/com/rocketcrew/pocatbatch/domain/auction/service/AuctionBatchService.javasrc/main/java/com/rocketcrew/pocatbatch/domain/outbox/service/OutboxEventWriter.javasrc/main/java/com/rocketcrew/pocatbatch/job/auctionactivation/AuctionActivationTasklet.javasrc/main/java/com/rocketcrew/pocatbatch/job/auctionexpiration/AuctionExpirationTasklet.javasrc/main/java/com/rocketcrew/pocatbatch/job/cardsync/CardSyncTasklet.javasrc/test/java/com/rocketcrew/pocatbatch/client/MainAuctionLifecycleClientTest.javasrc/test/java/com/rocketcrew/pocatbatch/client/MainCardSyncClientTest.javasrc/test/java/com/rocketcrew/pocatbatch/job/auctionactivation/AuctionActivationTaskletTest.javasrc/test/java/com/rocketcrew/pocatbatch/job/auctionexpiration/AuctionExpirationTaskletTest.javasrc/test/java/com/rocketcrew/pocatbatch/job/cardsync/CardSyncTaskletTest.java
💤 Files with no reviewable changes (3)
- src/main/java/com/rocketcrew/pocatbatch/domain/outbox/service/OutboxEventWriter.java
- src/main/java/com/rocketcrew/pocatbatch/domain/auction/service/AuctionBatchService.java
- src/main/java/com/rocketcrew/pocatbatch/domain/auction/entity/Auction.java
Summary
MainAuctionLifecycleClient신규:activate/closeExpired— POST/internal/auctions/{id}/activate|close-expired,ApiResponseEnvelope<Boolean>언래핑, 3회 재시도(1s→2s→4s), X-Internal-Token + Idempotency-Key 헤더MainCardSyncClient신규:triggerSync— POST/internal/cards/sync, 202 정상 / 409(CARD_SYNC_IN_PROGRESS) 스킵 / 401 → step 실패AuctionActivationTasklet/AuctionExpirationTaskletthin화: 자체 Redisson 락 +AuctionBatchService제거, 건별 client 호출 + 집계CardSyncTaskletthin화: TCGdex/CardRepository/OutboxEventWriter/RestTemplate 의존 전부 제거,triggerSync1회 호출AuctionBatchService삭제 (경매 활성화기간now.plusHours(7)CRITICAL 버그 포함),OutboxEventWriter조건부 삭제 (참조 0건 확인),Auction.activate()/end()死코드 삭제Test plan
MainAuctionLifecycleClientTest(MockRestServiceServer) GREEN 확인MainCardSyncClientTest(MockRestServiceServer) GREEN 확인AuctionActivationTaskletTest/AuctionExpirationTaskletTest/CardSyncTaskletTestGREEN 확인AuctionActivationJobConfigTest/AuctionExpirationJobConfigTest/CardSyncJobConfigTest회귀 없음 확인auctionActivationJob/auctionExpirationJob/cardSyncJob실제 실행 후 메인앱 로그에서/internal/**호출 확인Summary by CodeRabbit
Release Notes
New Features
Documentation
Refactor