From 78859ec699ed6e8851866ef033b6e499a3c1a991 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 8 Jul 2024 15:47:31 +0200 Subject: [PATCH] Properly await --- scripts/generateSummaryTileCache.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/generateSummaryTileCache.ts b/scripts/generateSummaryTileCache.ts index 49882ce85..0ff543618 100644 --- a/scripts/generateSummaryTileCache.ts +++ b/scripts/generateSummaryTileCache.ts @@ -40,18 +40,18 @@ class GenerateSummaryTileCache extends Script { if (existsSync(path)) { return JSON.parse(readFileSync(path, "utf8")) } - if(sleepMs > 0){ + if (sleepMs > 0) { await ScriptUtils.sleep(sleepMs) } let feature: Feature if (z >= 14) { feature = await this.fetchTile(z, x, y, layersSummed) } else { - const parts = await Promise.all([ - this.fetchTileRecursive(z + 1, x * 2, y * 2, layersSummed, 50), - this.fetchTileRecursive(z + 1, x * 2 + 1, y * 2, layersSummed,100), - this.fetchTileRecursive(z + 1, x * 2, y * 2 + 1, layersSummed,250), - this.fetchTileRecursive(z + 1, x * 2 + 1, y * 2 + 1, layersSummed, 500)]) + const parts = [ + await this.fetchTileRecursive(z + 1, x * 2, y * 2, layersSummed), + await this.fetchTileRecursive(z + 1, x * 2 + 1, y * 2, layersSummeawait d), + await this.fetchTileRecursive(z + 1, x * 2, y * 2 + 1, layersSummed), + await this.fetchTileRecursive(z + 1, x * 2 + 1, y * 2 + 1, layersSummed)] const sum = this.sumTotals(parts.map(f => f.properties)) feature = >{ type: "Feature",