File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1103,8 +1103,11 @@ def _check_if_more_attempts_allowed(
11031103 downloaded_in_attempt ,
11041104 )
11051105 attempts_allowed += 1
1106+ if attempt >= attempts_allowed :
1107+ lgr .debug ("%s - download failed after %d attempts: %s" , path , attempt , exc )
1108+ return None
11061109 # TODO: actually we should probably retry only on selected codes,
1107- if exc .response is not None :
1110+ elif exc .response is not None :
11081111 if exc .response .status_code not in (
11091112 400 , # Bad Request, but happened with gider:
11101113 # https://github.com/dandi/dandi-cli/issues/87
@@ -1141,11 +1144,12 @@ def _check_if_more_attempts_allowed(
11411144 exc ,
11421145 )
11431146 else :
1144- lgr .debug ("%s - download failed: %s" , path , exc )
1145- return None
1146- elif attempt >= attempts_allowed :
1147- lgr .debug ("%s - download failed after %d attempts: %s" , path , attempt , exc )
1148- return None
1147+ lgr .debug (
1148+ "%s - download failed on attempt #%d: %s, will sleep a bit and retry" ,
1149+ path ,
1150+ attempt ,
1151+ exc ,
1152+ )
11491153 # if is_access_denied(exc) or attempt >= 2:
11501154 # raise
11511155 # sleep a little and retry
You can’t perform that action at this time.
0 commit comments