Skip to content

Commit

Permalink
fix: 테스트를 위한 빌드업
Browse files Browse the repository at this point in the history
  • Loading branch information
parkdaye committed Aug 15, 2023
1 parent 69d883a commit ad52bef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public void add(String teamBuildingUuid, SseEmitter emitter) {
emitterList.add(emitter);
emitterMap.put(teamBuildingUuid, emitterList);

log.info("new emitter added: {}", emitter);
log.info("new emitter added: {}, {}", teamBuildingUuid, emitter);
log.info("emitter list size: {}", emitterList.size());
emitter.onCompletion(() -> {
log.info("onCompletion callback");
log.info("onCompletion callback : {}", emitter);
emitterList.remove(emitter);
});
emitter.onTimeout(() -> {
log.info("onTimeout callback");
log.info("onTimeout callback : {}", emitter);
emitterList.remove(emitter);
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.nexters.moyeomoyeo.notification.service;

import com.nexters.moyeomoyeo.notification.handler.SseEmitterHandler;
import java.io.IOException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
Expand All @@ -12,7 +11,8 @@
@RequiredArgsConstructor
public class NotificationService {

private static final Long DEFAULT_TIMEOUT = 60L * 1000 * 30;
//TODO 시간 원복
private static final Long DEFAULT_TIMEOUT = 60L * 1000 * 1;

private final SseEmitterHandler handler;

Expand All @@ -21,15 +21,15 @@ public void sendNotification(SseEmitter emitter, String name, Object data) {
emitter.send(SseEmitter.event()
.name(name)
.data(data));
} catch (IOException e) {
} catch (Exception e) {
log.error("fail to send message : {}", emitter);
}
}

public SseEmitter subscribe(String teamBuildingUuid) {
final SseEmitter emitter = new SseEmitter(DEFAULT_TIMEOUT);
sendNotification(emitter, "subscribe", "subscribe completed");
handler.add(teamBuildingUuid, emitter);
sendNotification(emitter, "subscribe", "subscribe completed");

return emitter;
}
Expand Down

0 comments on commit ad52bef

Please sign in to comment.