diff --git a/scripts/generatePmTilesExtracts.ts b/scripts/generatePmTilesExtracts.ts index bcc5b899f3..ce1f39c1a2 100644 --- a/scripts/generatePmTilesExtracts.ts +++ b/scripts/generatePmTilesExtracts.ts @@ -4,6 +4,7 @@ import { OfflineBasemapManager } from "../src/service-worker/OfflineBasemapManag import { spawn } from "child_process" import { existsSync } from "fs" +import { Utils } from "../src/Utils" class GeneratePmTilesExtracts extends Script { @@ -99,12 +100,17 @@ class GeneratePmTilesExtracts extends Script { const generator = this.generateAll() let batch: Promise[] = [] let done = 0 + const startDate = new Date() do { batch = this.createBatch(generator, numberOfThreads) await Promise.all(batch) done += batch.length + const now = new Date() + const timeElapsed = (now.getTime() - startDate.getTime()) / 1000 + const speed = ("" + (done / timeElapsed)).substring(0, 5) const perc = ("" + ((100 * (done + this.skipped) / estimate))).substring(0, 5) - console.log("Completed", numberOfThreads, `processes; ${done + this.skipped} / ${estimate}, ${perc}%`) + const etaSecond = Math.floor((estimate - done - this.skipped) * timeElapsed / done) + console.log("Completed", numberOfThreads, `processes; ${done + this.skipped} / ${estimate}, ${perc}%, ${speed} tile/second, ETA: ${Utils.toHumanTime(etaSecond)}`) } while (batch.length > 0) }