Skip to content

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
Thread.sleep((1000 * 2.0.pow(i)).toLong())
}
}
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
@dhasani23 dhasani23 merged commit 41cdbc7 into aws:main Dec 19, 2024
11 checks passed
karanA-aws pushed a commit to karanA-aws/aws-toolkit-jetbrains that referenced this pull request Jan 17, 2025
* fix(amazonq): retry S3 upload

* fix test

* fix detekt

* use waitUntil

* update changelog

* fix detekt

* fix detekt again

* remove unused import

* fix tests

* Update .changes/next-release/bugfix-552a4676-3214-4321-a332-344bdf9f1830.json

Co-authored-by: Richard Li <[email protected]>

---------

Co-authored-by: David Hasani <[email protected]>
Co-authored-by: Richard Li <[email protected]>
karanA-aws pushed a commit to karanA-aws/aws-toolkit-jetbrains that referenced this pull request Jan 22, 2025
* fix(amazonq): retry S3 upload

* fix test

* fix detekt

* use waitUntil

* update changelog

* fix detekt

* fix detekt again

* remove unused import

* fix tests

* Update .changes/next-release/bugfix-552a4676-3214-4321-a332-344bdf9f1830.json

Co-authored-by: Richard Li <[email protected]>

---------

Co-authored-by: David Hasani <[email protected]>
Co-authored-by: Richard Li <[email protected]>
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