remove worker timeout

This commit is contained in:
Evan
2024-12-03 19:20:07 -08:00
parent 5a4a62bb86
commit 9391dad131
3 changed files with 4 additions and 5 deletions
+3
View File
@@ -25,6 +25,9 @@ export const devConfig = new class extends DefaultConfig {
turnIntervalMs(): number {
return 100
}
tradeShipSpawnRate(): number {
return 10
}
// boatMaxDistance(): number {
// return 5000
// }
+1 -1
View File
@@ -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) {
-4
View File
@@ -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') {