Skip to content

fix: 티켓 번호 동시 생성 중복 방지 (#39)#40

Merged
LEESEOJUN-creator merged 1 commit into
devfrom
fix/#39-ticket-number-duplication
May 7, 2026
Merged

fix: 티켓 번호 동시 생성 중복 방지 (#39)#40
LEESEOJUN-creator merged 1 commit into
devfrom
fix/#39-ticket-number-duplication

Conversation

@LEESEOJUN-creator
Copy link
Copy Markdown
Contributor

관련 이슈

closes #39

문제

count() + 1 방식은 30초 스케줄러가 여러 Pod 이상을 동시에 감지할 때 같은 번호 생성 가능

스레드 A: count() = 5 → TKT-2026-006
스레드 B: count() = 5 → TKT-2026-006  ← 중복

수정

DB auto-increment id 기반으로 변경 — 저장 후 id로 번호 세팅하므로 중복 불가

ticket = ticketRepository.save(ticket);  // DB가 id 보장
ticket.initTicketNumber(String.format("TKT-%d-%03d", Year.now().getValue(), ticket.getId()));

count()+1 대신 DB auto-increment id 사용으로 동시성 문제 제거

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LEESEOJUN-creator LEESEOJUN-creator merged commit eaf93c9 into dev May 7, 2026
1 check 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