feat: Prevent GameServer from restarting after ending by introducin… (#2923)

If this PR fixes an issue, link it below. If not, delete these two
lines.
Resolves #(issue number)
#2919 


In GameManager.tick(), when a game becomes active but hasn't started, a
setTimeout for game.start() is scheduled with a 2-second delay. If the
game finishes or is cancelled within those 2 seconds, game.end() is
called, which clears the existing interval. However:

1.The 2-second timeout still fires. game.start() executes.
2. A NEW setInterval is created for turn execution.
3.Since the game is already ending/finished, it's removed from
GameManager.games, but the interval continues to run forever in the
background


## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

codimo
This commit is contained in:
Himansu Rawal
2026-01-21 09:39:57 +05:45
committed by GitHub
parent 4e4e1799d7
commit 8aa3e26e70
3 changed files with 127 additions and 2 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
"dev:prod": "cross-env GAME_ENV=dev API_DOMAIN=api.openfront.io concurrently \"npm run start:client\" \"npm run start:server-dev\"",
"docs:map-generator": "cd map-generator && go doc -cmd -u -all",
"tunnel": "npm run build-prod && npm run start:server",
"test": "vitest run",
"test": "vitest run && vitest run tests/server",
"perf": "npx tsx tests/perf/*.ts",
"test:coverage": "vitest run --coverage",
"format": "prettier --ignore-unknown --write .",