Skip to content

Commit

Permalink
Move attempt >= attempts_allowed check
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Dec 20, 2024
1 parent f7e6ea4 commit bb05a23
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dandi/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -1103,8 +1103,11 @@ def _check_if_more_attempts_allowed(
downloaded_in_attempt,
)
attempts_allowed += 1
if attempt >= attempts_allowed:
lgr.debug("%s - download failed after %d attempts: %s", path, attempt, exc)
return None

Check warning on line 1108 in dandi/download.py

View check run for this annotation

Codecov / codecov/patch

dandi/download.py#L1106-L1108

Added lines #L1106 - L1108 were not covered by tests
# TODO: actually we should probably retry only on selected codes,
if exc.response is not None:
elif exc.response is not None:

Check warning on line 1110 in dandi/download.py

View check run for this annotation

Codecov / codecov/patch

dandi/download.py#L1110

Added line #L1110 was not covered by tests
if exc.response.status_code not in (
400, # Bad Request, but happened with gider:
# https://github.com/dandi/dandi-cli/issues/87
Expand Down Expand Up @@ -1147,9 +1150,6 @@ def _check_if_more_attempts_allowed(
attempt,
exc,
)
elif attempt >= attempts_allowed:
lgr.debug("%s - download failed after %d attempts: %s", path, attempt, exc)
return None
# if is_access_denied(exc) or attempt >= 2:
# raise
# sleep a little and retry
Expand Down

0 comments on commit bb05a23

Please sign in to comment.