mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 13:30:43 +00:00
fix(worker): use executeNextTick() return value; keep types/lint clean
GameRunner.executeNextTick(): return false on error paths (never undefined) Worker loop drains via while (executeNextTick()) instead of separate hasPendingTurns() Remove stale LocalServer ReplaySpeedMultiplier/MAX_REPLAY_BACKLOG_TURNS imports/constants undoing part of Spectate catchup #3012
This commit is contained in:
@@ -20,13 +20,7 @@ import {
|
||||
import { getPersistentID } from "./Auth";
|
||||
import { LobbyConfig } from "./ClientGameRunner";
|
||||
import { ReplaySpeedChangeEvent } from "./InputHandler";
|
||||
import {
|
||||
defaultReplaySpeedMultiplier,
|
||||
ReplaySpeedMultiplier,
|
||||
} from "./utilities/ReplaySpeedMultiplier";
|
||||
|
||||
// build a small backlog so MAX can catch up.
|
||||
const MAX_REPLAY_BACKLOG_TURNS = 60;
|
||||
import { defaultReplaySpeedMultiplier } from "./utilities/ReplaySpeedMultiplier";
|
||||
|
||||
export class LocalServer {
|
||||
// All turns from the game record on replay.
|
||||
|
||||
@@ -145,7 +145,7 @@ export class GameRunner {
|
||||
console.error("Game tick error:", error);
|
||||
}
|
||||
this.isExecuting = false;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.game.inSpawnPhase() && this.game.ticks() % 2 === 0) {
|
||||
|
||||
@@ -48,8 +48,8 @@ async function processPendingTurns() {
|
||||
|
||||
isProcessingTurns = true;
|
||||
try {
|
||||
while (gr.hasPendingTurns()) {
|
||||
gr.executeNextTick();
|
||||
while (gr.executeNextTick()) {
|
||||
// Keep running until no pending turns.
|
||||
}
|
||||
} finally {
|
||||
isProcessingTurns = false;
|
||||
|
||||
Reference in New Issue
Block a user