Open nyhobbit opened 8 years ago
here is a test file that makes the problem evident. https://github.com/nyhobbit/smartcampus.gamification/blob/long-game/game-engine.test/src/test/java/eu/trentorise/LongGameTest.java
It's correct, there is a race condition and so we have a bug.
The issue happens when in test environment game defines some classification tasks and test simulates some game execution.
The bug affected only the test environment and not the runtime execution. This is because in test environment task execution is emulated invoking directly the execute method sequentially on the main thread, meanwhile game executions are queued on another thread.
In real situation the cronjob executes the task using the GameContext so the task calls to engine are queued on the same thread executor.
by the leaderboard definition - likely a race condition because it works when debugger is on.