Skip to content

Commit

Permalink
chore: #961 SchedulerService WS 삽입 구간 마킹
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly6bf committed Nov 18, 2024
1 parent 40fa718 commit bd30648
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public void start(final String key) {
if (schedulerRegistry.isActive(key)) {
return;
}
// TODO : WS로 전환
sseService.broadcast(key, "timer", "start");
if (isInitial(key)) {
final Timer timer = timerRepository.fetchTimerByAccessCode(key)
Expand Down Expand Up @@ -59,11 +60,13 @@ private void runTimer(final String key, final Timer timer) {
stop(key, timer);
return;
}
// TODO : WS로 전환
if (sseService.hasNoConnections(key) && schedulerRegistry.has(key)) {
pause(key);
return;
}
timer.decreaseRemainingTime(DELAY_SECOND.toMillis());
// TODO : WS로 전환
sseService.broadcast(key, "remaining-time", String.valueOf(timer.getRemainingTime()));
}

Expand All @@ -75,6 +78,7 @@ public void pause(final String key) {
}

private void stop(final String key, final Timer timer) {
// TODO : WS로 전환
sseService.broadcast(key, "timer", "stop");
schedulerRegistry.release(key);
final Timer initalTimer = new Timer(timer.getAccessCode(), timer.getDuration(), timer.getDuration());
Expand Down

0 comments on commit bd30648

Please sign in to comment.