Fix: Lobby cleanup got blocked by previous feature for rejoining lobby while game is still going #340

Merged
jona.walpert merged 1 commits from fix/lobby-cleanup-blocked into main 2026-05-15 15:40:46 +02:00
2 changed files with 6 additions and 1 deletions
@@ -98,9 +98,14 @@ public class GetGameStateHandler extends CommandHandler<GetGameStateRequest> {
}
try {
// Remove all active players
for (String playerName : lobby.getPlayerNames()) {
lobbyManager.removePlayer(playerName);
}
// Also remove all absent players so the lobby can be deleted
for (String playerName : lobby.getAbsentPlayers()) {
lobbyManager.removePlayer(playerName);
}
lobby.initGame(null);
} catch (RuntimeException e) {
LOGGER.log(
@@ -217,7 +217,7 @@ public class LobbyManager {
for (Map.Entry<LobbyId, Lobby> e : activeLobbies.entrySet()) {
LobbyId id = e.getKey();
Lobby l = e.getValue();
if (l.getPlayerNames().isEmpty()) {
if (!l.hasAnyPlayers()) {
Instant created = creationTimes.get(id);
if (created != null && created.isBefore(cutoff)) {
result.add(id);