Routing: start once the offline build's extracts are in, not after Planetiler; merged file keeps the .osm.pbf extension osmium needs
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 12s

This commit is contained in:
randy committed 2026-11-14 14:50:39 +01:00
1 parent ac7c7f3ba9
commit 58ca871662
4 files changed
+35 -15

No files matched your search

+19 -2
View File
@@ -164,6 +164,7 @@ module Maptool
# for those.
def self.reset!
OFFLINE_MUTEX.synchronize { OFFLINE_STATUS.replace(state: "idle") }
@fetching_extracts = false
TERRAIN_MUTEX.synchronize { TERRAIN_STATUS.replace(state: "idle") }
end
@@ -241,15 +242,30 @@ module Maptool
raise BuildError, "select at least one region first" if codes.empty?
begin_run!(OFFLINE_MUTEX, OFFLINE_STATUS)
@fetching_extracts = true
Thread.new do
run_job(OFFLINE_MUTEX, OFFLINE_STATUS, kind: "offline", data_dir: data_dir, regions: codes) do |report_step|
extract_offline(codes, data_dir, download_extract, fetch_last_modified, report_step)
end
# A routing build requested meanwhile waited for these extracts.
Routing.offline_build_finished(data_dir) if defined?(Routing)
extracts_ready(data_dir) # no-op unless the build failed before its extracts were in
end
end
# True while an offline build may still be replacing the extracts that
# a routing build reads; Planetiler afterwards doesn't touch them.
def self.fetching_extracts?
@fetching_extracts
end
# A routing build requested meanwhile waited for these extracts.
def self.extracts_ready(data_dir)
return unless @fetching_extracts
@fetching_extracts = false
Routing.extracts_ready(data_dir) if defined?(Routing)
end
private_class_method :extracts_ready
# fetch_manifest: same injectable-seam reasoning as download_extract
# above, for the one Mapterhorn manifest lookup this needs.
def self.build_terrain(data_dir:, fetch_manifest: method(:fetch_mapterhorn_manifest))
@@ -334,6 +350,7 @@ module Maptool
report_step.call(progress_step("fetching #{code}", codes, i))
cached_extract(code, slug, data_dir, download_extract, fetch_last_modified)
end
extracts_ready(data_dir)
osm_path =
if sources.size == 1