chore: add download max retries parameter to environment variables#180
Merged
rtuszik merged 2 commits intortuszik:mainfrom Nov 12, 2025
Merged
chore: add download max retries parameter to environment variables#180rtuszik merged 2 commits intortuszik:mainfrom
rtuszik merged 2 commits intortuszik:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- Consider converting and validating DOWNLOAD_MAX_RETRIES as an integer in your config module (with a fallback or warning on invalid values) so that the rest of your code can assume the type is correct.
- You may want to preserve the max_retries parameter in download_file’s signature (e.g. max_retries=None) to avoid breaking any existing calls or tests that rely on passing a custom retry count.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider converting and validating DOWNLOAD_MAX_RETRIES as an integer in your config module (with a fallback or warning on invalid values) so that the rest of your code can assume the type is correct.
- You may want to preserve the max_retries parameter in download_file’s signature (e.g. max_retries=None) to avoid breaking any existing calls or tests that rely on passing a custom retry count.
## Individual Comments
### Comment 1
<location> `src/downloader.py:505` </location>
<code_context>
-def download_file(url, destination, max_retries=3):
+def download_file(url, destination):
start_time = time.time()
+ max_retries = int(config.DOWNLOAD_MAX_RETRIES)
for attempt in range(max_retries):
</code_context>
<issue_to_address>
**suggestion:** Consider validating DOWNLOAD_MAX_RETRIES for non-integer or negative values.
Non-integer or negative values for DOWNLOAD_MAX_RETRIES may cause errors or unexpected behavior. Adding validation or a default fallback will improve robustness.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| def download_file(url, destination, max_retries=3): | ||
| def download_file(url, destination): | ||
| start_time = time.time() | ||
| max_retries = int(config.DOWNLOAD_MAX_RETRIES) |
Contributor
There was a problem hiding this comment.
suggestion: Consider validating DOWNLOAD_MAX_RETRIES for non-integer or negative values.
Non-integer or negative values for DOWNLOAD_MAX_RETRIES may cause errors or unexpected behavior. Adding validation or a default fallback will improve robustness.
rtuszik
approved these changes
Nov 12, 2025
Owner
rtuszik
left a comment
There was a problem hiding this comment.
Thanks for this one as well. Totally forgot about this, my bad!
Thanks for this PR I had the exact same problem! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This adds a new configuration parameter
DOWNLOAD_MAX_RETRIES, which can be set via an environment variable instead of using the hardcoded limit of three download attempts.Why
After testing in slower, “homelab-like” environments, I found that three attempts are sometimes not enough to complete the
planetdownload. This change allows to increase the number of retry attempts by setting the environment variable in the container.