fix: SSE 연결 후 대기열 미진입 상태에서 브로드캐스트 시 emitter 오삭제 방지#39
Draft
Jeongho0805 wants to merge 1 commit into
Draft
Conversation
SSE 접속(GET /api/order)과 대기열 등록(POST /api/order)은 별개의 요청이어서 두 호출 사이에 broadcastQueueInfo() 스케줄러가 실행되면 Redis에 초기 순번이 아직 없어 initialRank가 null이 된다. 기존 코드는 이를 error 로그 + emitter 삭제로 처리했으나, 이는 정상 연결 중인 SSE emitter를 잘못 종료시키는 문제를 야기한다. 대기열에 아직 진입하지 않은 클라이언트는 다음 브로드캐스트 주기에 재처리되도록 조용히 건너뛰도록 수정한다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 사항
sendQueueInfoToClient에서initialRank가 null일 때 error 로그 출력 및 emitter 삭제 코드 제거배경
Sentry 이슈 PRACTICKET-35:
initial rank is null for clientKey: 563b85cb-9d9d-40ff-9355-7e9a01526e82SSE 접속(
GET /api/order)과 대기열 등록(POST /api/order)은 별개의 API 요청이다. 클라이언트가GET으로 emitter를 저장한 뒤POST로 대기열에 진입하기 전 짧은 틈새에broadcastQueueInfo()스케줄러가 실행되면, Redisticket:queue:info해시에clientKey:initial-rank필드가 아직 없어getInitialRank()가 null을 반환한다. 기존 코드는 이를log.error+ emitter 즉시 삭제로 처리해 유효한 SSE 연결을 잘못 종료시키고 Sentry에 오탐 ERROR를 발생시켰다.initialRank == null은 과도기적 정상 상태이므로 조용히 건너뛰어 다음 주기에 재처리하도록 수정한다.