Skip to content

Commit e6fdeb2

Browse files
authored
Exponential back off in retry logic in case of http status code 0 (no response) (#2300)
* Exponential backoff during retry in case of http status code 0 (no response).
1 parent 817a8ef commit e6fdeb2

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

operator/src/main/java/oracle/kubernetes/operator/calls/AsyncRequestStep.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,6 @@ public NextAction doPotentialRetry(Step conflictStep, Packet packet, int statusC
430430
NextAction na = new NextAction();
431431
if (!retriesLeft()) {
432432
return null;
433-
} else if (statusCode == 0) {
434-
na.invoke(retryStep, packet);
435433
} else {
436434
LOGGER.finer(MessageKeys.ASYNC_RETRY, identityHash(), String.valueOf(waitTime),
437435
requestParams.call, requestParams.namespace, requestParams.name);

operator/src/test/java/oracle/kubernetes/operator/calls/AsyncRequestStepTest.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void afterFiberStarted_timeoutStepScheduled() {
104104
public void afterTimeout_newRequestSent() {
105105
callFactory.clearRequest();
106106

107-
testSupport.setTime(TIMEOUT_SECONDS, TimeUnit.SECONDS);
107+
testSupport.setTime(TIMEOUT_SECONDS + 1, TimeUnit.SECONDS);
108108

109109
assertTrue(callFactory.invokedWith(requestParams));
110110
}
@@ -158,22 +158,14 @@ public void afterFailedCallback_retrySentAfterDelay() {
158158

159159
@Test
160160
public void afterMultipleRetriesAndSuccessfulCallback_nextStepAppliedWithValue() {
161-
sendMultipleFailedCallback(0, 2);
161+
sendMultipleFailedCallbackWithSetTime(0, 2);
162162
testSupport.schedule(() -> callFactory.sendSuccessfulCallback(smallList));
163163
assertThat(nextStep.result, equalTo(smallList));
164164
}
165165

166-
@SuppressWarnings("SameParameterValue")
167-
private void sendMultipleFailedCallback(int statusCode, int maxRetries) {
168-
for (int retryCount = 0; retryCount < maxRetries; retryCount++) {
169-
testSupport.schedule(
170-
() -> callFactory.sendFailedCallback(new ApiException("test failure"), statusCode));
171-
}
172-
}
173-
174166
@Test
175167
public void afterRetriesExhausted_fiberTerminatesWithException() {
176-
sendMultipleFailedCallback(0, 3);
168+
sendMultipleFailedCallbackWithSetTime(0, 3);
177169

178170
testSupport.verifyCompletionThrowable(FailureStatusSourceException.class);
179171
}

0 commit comments

Comments
 (0)