2424@ RequestMapping ()
2525public class RoomApiController {
2626
27- private static final String SMOKETEST_ROOM_NAME_PREFIX = "testroom-" ;
27+ private static final String SMOKETEST_ROOM_NAME = "testroom-310a9c47-515c-4ad7-a229-ae8efbab7387 " ;
2828 private static final Logger log = LoggerFactory .getLogger (RoomApiController .class );
2929 private final RoomRepository roomRepository ;
3030 private final Clock clock ;
@@ -83,9 +83,7 @@ public void publishEvent(@PathVariable String roomId, @RequestBody PutTimerReque
8383 timerRequest .timer ,
8484 timerRequest .user ,
8585 room .name ());
86- if (!room .name ().startsWith (SMOKETEST_ROOM_NAME_PREFIX )) {
87- stats .incrementTimer (timer );
88- }
86+ incrementTimerStatsExceptForTestRoom (room , timer );
8987 } else if (timerRequest .breaktimer () != null ) {
9088 long breaktimer = truncateTooLongTimers (timerRequest .breaktimer ());
9189 room .addBreaktimer (breaktimer , timerRequest .user ());
@@ -94,14 +92,24 @@ public void publishEvent(@PathVariable String roomId, @RequestBody PutTimerReque
9492 timerRequest .breaktimer (),
9593 timerRequest .user ,
9694 room .name ());
97- if (!room .name ().startsWith (SMOKETEST_ROOM_NAME_PREFIX )) {
98- stats .incrementBreaktimer (breaktimer );
99- }
95+ incrementBreakTimerStatsExceptForTestRoom (room , breaktimer );
10096 } else {
10197 log .warn ("Could not understand PUT request for room {}" , roomId );
10298 }
10399 }
104100
101+ private void incrementBreakTimerStatsExceptForTestRoom (Room room , long breaktimer ) {
102+ if (!Objects .equals (room .name (), SMOKETEST_ROOM_NAME )) {
103+ stats .incrementBreaktimer (breaktimer );
104+ }
105+ }
106+
107+ private void incrementTimerStatsExceptForTestRoom (Room room , long timer ) {
108+ if (!Objects .equals (room .name (), SMOKETEST_ROOM_NAME )) {
109+ stats .incrementTimer (timer );
110+ }
111+ }
112+
105113 private static long truncateTooLongTimers (Long timer ) {
106114 return Math .min (60 * 24 , Math .max (0 , timer ));
107115 }
0 commit comments