File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
backend/src/main/java/io/f1/backend/domain/game Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,15 @@ public class TimerService {
2727
2828 public void startTimer (Room room , int delaySec ) {
2929 cancelTimer (room );
30- ScheduledFuture <?> timer = room .getTimer ();
31- timer =
32- room .getScheduler ()
33- .schedule (
34- () -> {
35- handleTimeout (room );
36- },
37- delaySec + room .getGameSetting ().getTimeLimit (),
38- TimeUnit .SECONDS );
30+
31+ ScheduledFuture <?> timer = room .getScheduler ().schedule (() -> {
32+ handleTimeout (room );
33+ }, delaySec + room .getGameSetting ().getTimeLimit (), TimeUnit .SECONDS );
34+
35+ room .updateTimer (timer );
3936 }
4037
4138 private void handleTimeout (Room room ) {
42-
4339 String destination = getDestination (room .getId ());
4440
4541 messageSender .send (
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public class GameSetting {
1111
1212 private Long quizId ;
1313 private Integer round ; // 게임 변경 시 해당 게임의 총 문제 수로 설정
14- private int timeLimit = 60 ;
14+ private int timeLimit ;
1515
1616 public boolean validateQuizId (Long quizId ) {
1717 return Objects .equals (this .quizId , quizId );
Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ public void updateRoomState(RoomState newState) {
6363 this .state = newState ;
6464 }
6565
66+ public void updateTimer (ScheduledFuture <?> timer ) {
67+ this .timer = timer ;
68+ }
69+
6670 public void removeUserId (Long id ) {
6771 this .userIdSessionMap .remove (id );
6872 }
You can’t perform that action at this time.
0 commit comments