tests: improved load tests (better logs)

This commit is contained in:
Oleg Agafonov 2025-02-04 14:23:15 +04:00
parent b29a969fdb
commit 690bc36023
4 changed files with 17 additions and 7 deletions

View file

@ -1004,7 +1004,15 @@ public class MageServerImpl implements MageServer {
if (ex.getMessage() != null && !ex.getMessage().equals("No message")) {
throw new MageException("Server error: " + ex.getMessage());
}
logger.error("unknown error", ex); // TODO: on logs spamming (e.g. connection problems) move it inside condition block above
if (ex instanceof ConcurrentModificationException) {
// how-to fix: game objects must be accessible by game thread only, all other threads must work with copies
logger.error("wrong threads sync error", ex);
} else {
// TODO: on logs spamming (e.g. connection problems) move it inside condition block above
logger.error("unknown error", ex);
}
}
@Override

View file

@ -42,6 +42,8 @@ public class GameSessionWatcher {
if (!killed) {
Optional<User> user = userManager.getUser(userId);
if (user.isPresent()) {
// TODO: can be called outside of the game thread, e.g. user start watching already running game
// possible fix: getGameView must use last cached value in non game thread call (split by sessions)
user.get().fireCallback(new ClientCallback(ClientCallbackMethod.GAME_INIT, game.getId(), getGameView()));
return true;
}