Routing: reject a pre-merge multi-country request, don't resume a failed build, Apply queues when the running build lacks the merge
CI / check (push) Successful in 17s
CI / deploy (push) Successful in 27s

This commit is contained in:
randy committed 2026-11-14 12:13:25 +01:00
1 parent acf5256c74
commit dbe1804ebf
2 files changed
+7 -2

No files matched your search

+6 -1
View File
@@ -62,6 +62,10 @@ build() {
mv "$R/build-request.json" "$S/request.json"
regions=$(python3 -c 'import json,sys; print(" ".join(json.load(open(sys.argv[1]))["regions"]))' "$S/request.json")
pbf=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1])).get("pbf", ""))' "$S/request.json")
if [ -z "$pbf" ] && [ "$(echo $regions | wc -w)" -gt 1 ]; then # a request from before the merge
status error "" "this request has several countries but no merged extract; click Apply again"
return 1
fi
if [ -n "$pbf" ]; then # several countries, merged by maptool (Valhalla breaks on overlapping extracts)
ln "/data/$pbf" "$R/pbf/" || { status error "" "missing $pbf"; return 1; }
else
@@ -103,7 +107,8 @@ if [ -f "$S/request.json" ] && [ ! -f "$R/build-request.json" ]; then
fi
serve
while true; do
[ -f "$R/build-request.json" ] && build
# A failed build isn't retried by the next restart.
[ -f "$R/build-request.json" ] && { build || rm -f "$S/request.json"; }
# valhalla_service died (or never started): start it again.
if [ -n "$SERVICE_PID" ] && ! kill -0 "$SERVICE_PID" 2>/dev/null; then serve; fi
sleep 10 & wait $! # interruptible, so the trap above runs right away