Skip to content

Conversation

carlos-villavicencio-adsk
Copy link
Contributor

@carlos-villavicencio-adsk carlos-villavicencio-adsk changed the title Retry S3 uploads on error 500 SG-34197 Retry S3 uploads on error 500 Jan 26, 2024
julien-lang
julien-lang previously approved these changes Jan 26, 2024
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))
Copy link
Contributor

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))

Copy link
Contributor

@julien-lang julien-lang left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@NorberMV NorberMV left a comment

Choose a reason for hiding this comment

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

LGTM!, nice job!

@carlos-villavicencio-adsk carlos-villavicencio-adsk merged commit d504a5a into master Jan 29, 2024
@carlos-villavicencio-adsk carlos-villavicencio-adsk deleted the ticket/SG-34197_retry_s3_upload_on_500 branch January 29, 2024 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants