forked from MapComplete/MapComplete
Properly await
This commit is contained in:
parent
a7f1295d9a
commit
78859ec699
1 changed files with 6 additions and 6 deletions
|
@ -40,18 +40,18 @@ class GenerateSummaryTileCache extends Script {
|
||||||
if (existsSync(path)) {
|
if (existsSync(path)) {
|
||||||
return JSON.parse(readFileSync(path, "utf8"))
|
return JSON.parse(readFileSync(path, "utf8"))
|
||||||
}
|
}
|
||||||
if(sleepMs > 0){
|
if (sleepMs > 0) {
|
||||||
await ScriptUtils.sleep(sleepMs)
|
await ScriptUtils.sleep(sleepMs)
|
||||||
}
|
}
|
||||||
let feature: Feature<Point>
|
let feature: Feature<Point>
|
||||||
if (z >= 14) {
|
if (z >= 14) {
|
||||||
feature = await this.fetchTile(z, x, y, layersSummed)
|
feature = await this.fetchTile(z, x, y, layersSummed)
|
||||||
} else {
|
} else {
|
||||||
const parts = await Promise.all([
|
const parts = [
|
||||||
this.fetchTileRecursive(z + 1, x * 2, y * 2, layersSummed, 50),
|
await this.fetchTileRecursive(z + 1, x * 2, y * 2, layersSummed),
|
||||||
this.fetchTileRecursive(z + 1, x * 2 + 1, y * 2, layersSummed,100),
|
await this.fetchTileRecursive(z + 1, x * 2 + 1, y * 2, layersSummeawait d),
|
||||||
this.fetchTileRecursive(z + 1, x * 2, y * 2 + 1, layersSummed,250),
|
await this.fetchTileRecursive(z + 1, x * 2, y * 2 + 1, layersSummed),
|
||||||
this.fetchTileRecursive(z + 1, x * 2 + 1, y * 2 + 1, layersSummed, 500)])
|
await this.fetchTileRecursive(z + 1, x * 2 + 1, y * 2 + 1, layersSummed)]
|
||||||
const sum = this.sumTotals(parts.map(f => f.properties))
|
const sum = this.sumTotals(parts.map(f => f.properties))
|
||||||
feature = <Feature<Point>>{
|
feature = <Feature<Point>>{
|
||||||
type: "Feature",
|
type: "Feature",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue