Skip rebuilding offline/terrain data when nothing actually changed
This commit is contained in:
1 parent
17d1adedbc
commit
3f9c46e846
1 file changed
+17
@@ -274,6 +274,23 @@ class DataFileRow {
|
|||||||
// Called by OfflineDataControl once RegionPicker's Apply has saved a
|
// Called by OfflineDataControl once RegionPicker's Apply has saved a
|
||||||
// new selection — not tied to a button of this row's own.
|
// new selection — not tied to a button of this row's own.
|
||||||
async triggerBuild() {
|
async triggerBuild() {
|
||||||
|
this._statusEl.textContent = "Checking…";
|
||||||
|
try {
|
||||||
|
// false (not null/true — see offline_update_available? in
|
||||||
|
// pmtiles_builder.rb) means the just-saved selection matches what's
|
||||||
|
// already on disk byte-for-byte: same countries, nothing upstream
|
||||||
|
// changed. Rebuilding would just burn bandwidth/CPU to reproduce
|
||||||
|
// the same file, so skip it. null (never built, or can't tell)
|
||||||
|
// still falls through to building below.
|
||||||
|
const check = await (await fetch(this._checkUpdateUrl)).json();
|
||||||
|
if (check.update_available === false) {
|
||||||
|
this._refreshStatus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// couldn't tell — fall through and build rather than silently skip
|
||||||
|
}
|
||||||
|
|
||||||
this._statusEl.textContent = "Starting…";
|
this._statusEl.textContent = "Starting…";
|
||||||
try {
|
try {
|
||||||
const response = await fetch(this._buildUrl, { method: "POST" });
|
const response = await fetch(this._buildUrl, { method: "POST" });
|
||||||
|
|||||||
Reference in new issue
Block a user