more logging

This commit is contained in:
LionTion committed 2026-10-22 20:27:30 +02:00
1 parent 210fdde27e
commit e42b313640
2 files changed
+5 -3

No files matched your search

@@ -51,16 +51,18 @@ public class CodeController {
t.setActivationTimestamp(now);
tourCodeService.updateCode(t);
} else if (activationTimestamp.plus(12, ChronoUnit.HOURS).isBefore(now)) {
logger.warning("Tour " + t.getCode() + " expired");
return ResponseEntity.notFound().build();
}
LocalDateTime heartbeat = t.getLastHeartbeatTimestamp();
if (heartbeat != null && heartbeat.plus(3, ChronoUnit.MINUTES).isAfter(now)) {
logger.warning("Tour " + t.getCode() + " was tried to be accessed.");
return ResponseEntity.notFound().build();
}
t.setLastHeartbeatTimestamp(now);
tourCodeService.updateCode(t);
TourSession tourSession = tourSessionService.getSessionByTourCode(t);
logger.info("Tour: " + t.getCode() + " started playing with Session " + tourSession);
logger.info("Tour " + t.getCode() + " started playing with Session " + tourSession);
return ResponseEntity.ok(
GetSessionAndAllRiddleData.builder()
.riddles(riddleService.getAllRiddles().stream()
@@ -93,7 +95,7 @@ public class CodeController {
}
if (t == null) {
t = tourCodeService.addTourCode(code);
System.out.println("DEBUG: Created TC " + t.getId());
logger.info("Created TC " + t.getId());
return ResponseEntity.ok(t.getCode());
}
return ResponseEntity.badRequest().body("BAD: " + t.getId());
@@ -32,7 +32,7 @@ public class SessionController {
}
TourSession session = tourSessionService.getSessionByTourCode(code);
if (session == null || !session.getTourCode().getActivated()) {
System.out.println("Session not found for " + code);
logger.info("Session not found for " + code);
return "Not available";
}
return String.format("%s", session.getData());