Skip to content

Commit

Permalink
Merge pull request #224 from EFUB4-Jukebox/develop
Browse files Browse the repository at this point in the history
[Prod] 베퍼 v0.7.2
  • Loading branch information
seohyun-lee authored Aug 21, 2024
2 parents feaca0b + 3d4e330 commit 78fa2f9
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import sws.songpin.domain.member.service.MemberService;

import java.io.IOException;
import java.util.Optional;

@Slf4j
@Service
Expand All @@ -24,7 +25,12 @@ public class EmitterService {

public SseEmitter subscribe() {
Member member = memberService.getCurrentMember();
SseEmitter emitter = registerEmitter(member.getMemberId());
Long memberId = member.getMemberId();

// 이미 존재하는 Emitter가 있는지 확인
SseEmitter emitter = Optional.ofNullable(emitterRepository.get(memberId))
.orElseGet(() -> registerEmitter(memberId));

sendToClientIfNewAlarmExists(member);
return emitter;
}
Expand Down

0 comments on commit 78fa2f9

Please sign in to comment.