Skip to content

Commit cc3deda

Browse files
authored
chore: improve retry conditions (#177)
This commit adds an extra status code check to the `shouldRetry` method.
1 parent 605ce58 commit cc3deda

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/ibm/cloud/sdk/core/http/RetryInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ protected int getInterval(Response response, Request request) {
186186
*/
187187
protected boolean shouldRetry(Response response, Request request) {
188188
// First check the response.
189-
if (response.code() == 429 || (response.code() >= 500 && response.code() != 501)) {
189+
if (response.code() == 429 || (response.code() >= 500 && response.code() <= 599 && response.code() != 501)) {
190190
// Now check if we exhausted the max number of retries or not.
191191
RetryContext context = request.tag(RetryContext.class);
192192
if (context != null && !context.incCountAndCheck()) {

0 commit comments

Comments
 (0)