network: improved stability (random errors related to #11285 and ConcurrentModificationException);

This commit is contained in:
Oleg Agafonov 2023-12-09 16:22:29 +04:00
parent 6aaaa8cb46
commit 414699f7d4

View file

@ -97,8 +97,11 @@ public class GameSessionWatcher {
}
public GameView getGameView() {
GameView gameView = new GameView(game.getState(), game, null, userId);
processWatchedHands(game, userId, gameView);
// game view calculation can take some time, so use copy for thread save (protection from ConcurrentModificationException)
Game sourceGame = game.copy();
GameView gameView = new GameView(sourceGame.getState(), sourceGame, null, userId);
processWatchedHands(sourceGame, userId, gameView);
return gameView;
}