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

fix(amazonq): retry S3 upload #5208

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

fix(amazonq): retry S3 upload #5208

wants to merge 9 commits into from

Conversation

dhasani23
Copy link
Contributor

@dhasani23 dhasani23 commented Dec 15, 2024

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

Retry S3 upload.

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@dhasani23 dhasani23 requested review from a team as code owners December 15, 2024 00:45
}
LOG.info { "Upload to S3 succeeded" }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not a big fan of implementing our own retry logic rather than doing it at the SDK layer, but the existing S3 client's upload functionality requires a bucket name as a part of the request, and 1) I don't think we should have the internal S3 bucket names we use floating around this repo, 2) we use multiple different buckets, and 3) we don't have access to the bucket name in the response of our CreateUploadUrl — this API would have to be changed and then we can use the existing S3 client.

Copy link
Contributor Author

@dhasani23 dhasani23 Dec 17, 2024

Choose a reason for hiding this comment

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

Update: use waitUntil instead of a for loop; makes this retry logic even simpler

@dhasani23 dhasani23 marked this pull request as draft December 15, 2024 00:47
UnknownHostException::class,
SocketTimeoutException::class,
HttpRequests.HttpStatusException::class,
ConnectException::class
Copy link
Contributor Author

Choose a reason for hiding this comment

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

UnknownHostException and SocketTimeoutException can be reproduced by turning off your WiFi, HttpStatusException could be a 500 or something, and I've occasionally seen ConnectException too, so I think all of these are worth retrying on.

@dhasani23 dhasani23 marked this pull request as ready for review December 17, 2024 18:35
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.

2 participants