Skip to content

Commit

Permalink
Merge pull request #31 from rtuszik/fix-space-check
Browse files Browse the repository at this point in the history
refactor: Move disk space check to download_index function
  • Loading branch information
rtuszik authored Jan 13, 2025
2 parents 1f7f597 + 9e89f6e commit dac61d9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions start-photon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ download_index() {
mkdir -p "$TEMP_DIR"

local url="https://download1.graphhopper.com/public/photon-db-latest"
if [[ -n "${COUNTRY_CODE:-}" ]]; then
url="https://download1.graphhopper.com/public/extracts/by-country-code/${COUNTRY_CODE}/photon-db-${COUNTRY_CODE}-latest"
fi

# Check disk space before downloading
check_disk_space "$url"
url="https://download1.graphhopper.com/public/photon-db-latest"
if [[ -n "${COUNTRY_CODE:-}" ]]; then
url="https://download1.graphhopper.com/public/extracts/by-country-code/${COUNTRY_CODE}/photon-db-${COUNTRY_CODE}-latest"
Expand Down Expand Up @@ -281,11 +287,6 @@ interval_to_seconds() {
# Main execution
main() {
mkdir -p "$DATA_DIR" "$TEMP_DIR"
url="https://download1.graphhopper.com/public/photon-db-latest"
if [[ -n "${COUNTRY_CODE:-}" ]]; then
url="https://download1.graphhopper.com/public/extracts/by-country-code/${COUNTRY_CODE}/photon-db-${COUNTRY_CODE}-latest"
fi
check_disk_space "$url"

if [ -d "$INDEX_DIR" ]; then
if verify_structure "$DATA_DIR"; then
Expand Down

0 comments on commit dac61d9

Please # to comment.