mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-28 16:04:15 +00:00
Increase worker initailization timeout from 5=>20s to prevent worker timeout, add duration logging to some longer operations
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user