Skip to content

Commit

Permalink
#80 adding retry policy to avoid API rate limiting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryblake committed Jun 21, 2019
1 parent 4ab85e1 commit 5f587f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicSessionCredentials;
import com.amazonaws.auth.InstanceProfileCredentialsProvider;
import com.amazonaws.retry.PredefinedRetryPolicies;
import com.atlassian.bamboo.task.CommonTaskContext;
import com.atlassian.bamboo.variable.VariableContext;
import com.atlassian.bamboo.variable.VariableDefinitionContext;
Expand Down Expand Up @@ -58,7 +59,9 @@ public static AWSCredentials getCredentials(CommonTaskContext context) {
}

public static ClientConfiguration getConfiguration() {
return new ClientConfiguration().withMaxErrorRetry(10);
return new ClientConfiguration()
.withMaxErrorRetry(10)
.withRetryPolicy(PredefinedRetryPolicies.getDefaultRetryPolicyWithCustomMaxRetries(10));
}

private static String lookupVar(String key, CommonTaskContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.retry.PredefinedRetryPolicies;

public class CredentialsHandler {

Expand All @@ -35,6 +36,8 @@ public static AWSCredentials getCredentials() {
}

public static ClientConfiguration getConfiguration() {
return new ClientConfiguration().withMaxErrorRetry(10);
return new ClientConfiguration()
.withMaxErrorRetry(10)
.withRetryPolicy(PredefinedRetryPolicies.getDefaultRetryPolicyWithCustomMaxRetries(10));
}
}

0 comments on commit 5f587f5

Please sign in to comment.