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

Improve retry logic with S3 client #613

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ class S3Bucket(
s3.getObject(req).getObjectContent
}

/** FIXME: We should not rely on the [[AmazonClientException#isRetryable]] method since it's for internal use.
*/
private[this] def handler: PartialFunction[Throwable, Boolean] = {
case ex: AmazonS3Exception =>
ex.getStatusCode match {
Expand All @@ -332,15 +334,15 @@ class S3Bucket(
}

case ex: AmazonServiceException =>
logger.error(s"Service error: ${ex.getMessage}", ex); ex.isRetryable
logger.error(s"Service error: ${ex.getMessage}", ex); !ex.isRetryable

case ex: AmazonClientException
if ex.getMessage ==
"Unable to load AWS credentials from any provider in the chain" =>
logger.error("Unable to load AWS credentials", ex); true

case ex: AmazonClientException =>
logger.error("Client error pulling file", ex); ex.isRetryable
logger.error("Client error pulling file", ex); !ex.isRetryable

case ex: Exception =>
logger.error("An error occurred", ex); false
Expand Down
Loading