Routing: reject a pre-merge multi-country request, don't resume a failed build, Apply queues when the running build lacks the merge
This commit is contained in:
1 parent
acf5256c74
commit
dbe1804ebf
2 files changed
+7
-2
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user