Increase worker initailization timeout from 5=>20s to prevent worker timeout, add duration logging to some longer operations

This commit is contained in:
evanpelle
2026-01-19 19:26:09 -08:00
parent 9d0ae10912
commit 697a346c86
3 changed files with 11 additions and 1 deletions
+4
View File
@@ -51,6 +51,7 @@ export class FetchGameMapLoader implements GameMapLoader {
}
private async loadBinaryFromUrl(url: string) {
const startTime = performance.now();
const response = await fetch(url);
if (!response.ok) {
@@ -58,6 +59,9 @@ export class FetchGameMapLoader implements GameMapLoader {
}
const data = await response.arrayBuffer();
console.log(
`[MapLoader] ${url}: ${(performance.now() - startTime).toFixed(0)}ms`,
);
return new Uint8Array(data);
}
+6
View File
@@ -103,6 +103,8 @@ export class GameImpl implements Game {
private _config: Config,
private _stats: Stats,
) {
const constructorStart = performance.now();
this._terraNullius = new TerraNulliusImpl();
this._width = _map.width();
this._height = _map.height();
@@ -123,6 +125,10 @@ export class GameImpl implements Game {
{ cachePaths: true },
);
}
console.log(
`[GameImpl] Constructor total: ${(performance.now() - constructorStart).toFixed(0)}ms`,
);
}
private populateTeams() {
+1 -1
View File
@@ -80,7 +80,7 @@ export class WorkerClient {
this.messageHandlers.delete(messageId);
reject(new Error("Worker initialization timeout"));
}
}, 5000); // 5 second timeout
}, 20000); // 20 second timeout
});
}