Skip to content

retry failed elevation tile download - #4461

Merged
nilsnolde merged 5 commits into
masterfrom
nn-elevation-download
Dec 18, 2023
Merged

nilsnolde merged 5 commits into
masterfrom
nn-elevation-download

Conversation

@nilsnolde

Copy link
Copy Markdown
Member

fixes #4425

except URLError as e:
LOGGER.critical(f"Download failed of elevation tile {tile.dir}/{tile.name}: {e.reason}")

download_status = DownloadStatus.FAILED

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of the diff is just wrapping the previous logic into a for loop, where we request 15 times maximum with increased sleeps in between (exponential back off), up to 4.5 hours until we give up. could give much earlier though :D

Comment on lines +260 to +262
try:
uncompressed = gz.read()
except Exception as e:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protect for corrupt downloads

Comment on lines +301 to +303
if download_status == DownloadStatus.CORRUPTED:
LOGGER.error(f"Tile {tile.dir}/{tile.name} was corrupted, removing it...")
filepath.unlink()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it was corrupted in the end, let's remove that tile from the file system

kevinkreiser
kevinkreiser previously approved these changes Dec 18, 2023

@kevinkreiser kevinkreiser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use 4 or something instead of 15 tries

@nilsnolde

Copy link
Copy Markdown
Member Author

changed it to 5 retries, totalling 7.5 mins in worst case.

@nilsnolde

Copy link
Copy Markdown
Member Author

not gonna merge master again with the admin changes

@nilsnolde
nilsnolde merged commit 52d6ca7 into master Dec 18, 2023
@nilsnolde
nilsnolde deleted the nn-elevation-download branch December 18, 2023 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

valhalla_build_elevation is not robust to corrupt downloads

2 participants