mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-22 14:37:31 +00:00
remove worker timeout
This commit is contained in:
@@ -25,6 +25,9 @@ export const devConfig = new class extends DefaultConfig {
|
||||
turnIntervalMs(): number {
|
||||
return 100
|
||||
}
|
||||
tradeShipSpawnRate(): number {
|
||||
return 10
|
||||
}
|
||||
// boatMaxDistance(): number {
|
||||
// return 5000
|
||||
// }
|
||||
|
||||
@@ -51,7 +51,7 @@ function initializeMap(data: { gameMap: GameMap }) {
|
||||
};
|
||||
});
|
||||
self.postMessage({ type: 'initialized' });
|
||||
processingInterval = setInterval(computeSearches, 100000) as unknown as number;
|
||||
processingInterval = setInterval(computeSearches, .1) as unknown as number;
|
||||
}
|
||||
|
||||
function findPath(terrainMap: TerrainMap, miniTerrainMap: TerrainMap, req: SearchRequest) {
|
||||
|
||||
@@ -63,15 +63,11 @@ export class ParallelAStar implements AStar {
|
||||
findPath(): Promise<void> {
|
||||
const requestId = crypto.randomUUID();
|
||||
this.promise = new Promise((resolve, reject) => {
|
||||
const timeout = setTimeout(() => {
|
||||
reject("Path timeout");
|
||||
}, 100000);
|
||||
|
||||
const handler = (e: MessageEvent) => {
|
||||
if (e.data.requestId != requestId) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(timeout);
|
||||
this.worker.removeEventListener('message', handler);
|
||||
|
||||
if (e.data.type === 'pathFound') {
|
||||
|
||||
Reference in New Issue
Block a user