Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue retrying downloads on retriable statuses #1558

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions dandi/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,8 +1141,12 @@
exc,
)
else:
lgr.debug("%s - download failed: %s", path, exc)
return None
lgr.debug(

Check warning on line 1144 in dandi/download.py

View check run for this annotation

Codecov / codecov/patch

dandi/download.py#L1144

Added line #L1144 was not covered by tests
"%s - download failed on attempt #%d: %s, will sleep a bit and retry",
path,
attempt,
exc,
)
elif attempt >= attempts_allowed:
Copy link
Member Author

Choose a reason for hiding this comment

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

@yarikoptic Question: Shouldn't this check be at the top of the function? Otherwise, if we keep hitting, say, 500 responses, it'll keep retrying beyong the maximum number of attempts.

Copy link
Member

Choose a reason for hiding this comment

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

indeed. But after potential increment of attempts_allowed in the "aggressive" mode.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in bb05a23.

lgr.debug("%s - download failed after %d attempts: %s", path, attempt, exc)
return None
Expand Down
Loading