Retry pmtiles extract/merge on failure, not just on the first try
CI / check (push) Successful in 39s
CI / deploy (push) Successful in 12s

This commit is contained in:
randy committed 2026-09-12 12:50:09 +02:00
1 parent 5c3151c2f5
commit cd02b03502
1 file changed
+10 -3
+10 -3
View File
@@ -629,9 +629,16 @@ module Maptool
end
private_class_method :command_output
def self.run_pmtiles!(*args)
stdout, stderr, status = Open3.capture3(pmtiles_bin, *args)
raise BuildError, "pmtiles exited with status #{status.exitstatus}: #{command_output(stdout, stderr)}" unless status.success?
# extract/merge stream tens of GB over HTTP range requests; retry a
# transient failure (e.g. a mid-transfer HTTP/2 stream reset from the
# remote) a couple times before giving up, rather than forcing a full
# re-download on every hiccup.
def self.run_pmtiles!(*args, attempts: 3)
attempts.times do |i|
stdout, stderr, status = Open3.capture3(pmtiles_bin, *args)
return if status.success?
raise BuildError, "pmtiles exited with status #{status.exitstatus}: #{command_output(stdout, stderr)}" if i == attempts - 1
end
rescue Errno::ENOENT, Errno::EACCES => e
raise BuildError, "could not run '#{pmtiles_bin}' (#{e.message}) — is go-pmtiles installed and on PATH? See docs/development.adoc."
end