-
Notifications
You must be signed in to change notification settings - Fork 199
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
SG-34197 Retry S3 uploads on error 500 #324
SG-34197 Retry S3 uploads on error 500 #324
Conversation
carlos-villavicencio-adsk
commented
Jan 26, 2024
- Follow up work from SG-20154 Add Retries on 503 Errors when uploading to S3 in Shotgun python-api #263
- Include error 500s retries when uploading to S3 cloud
shotgun_api3/shotgun.py
Outdated
if e.code == 503: | ||
raise ShotgunError("Got a 503 response when uploading to %s: %s" % (storage_url, e)) | ||
if e.code in [500, 503]: | ||
raise ShotgunError("Got a %s response when uploading to %s: %s" % (e.code, storage_url, e)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor non-blocking point, the code could be easier to read this way IMO:
if attempt != max_attempts and e.code in [500, 503]:
LOG.debug("Got a %s response. Waiting and retrying..." % e.code)
time.sleep(float(attempt) * backoff)
attempt += 1
continue
elif e.code in [500, 503]:
raise ShotgunError("Got a %s response when uploading to %s: %s" % (e.code, storage_url, e))
else:
raise ShotgunError("Unanticipated error occurred uploading to %s: %s" % (storage_url, e))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!, nice job!