Skip to content

Exponential back off in retry logic in case of http status code 0 (no response) #2300

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

Merged
merged 2 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,6 @@ public NextAction doPotentialRetry(Step conflictStep, Packet packet, int statusC
NextAction na = new NextAction();
if (!retriesLeft()) {
return null;
} else if (statusCode == 0) {
na.invoke(retryStep, packet);
} else {
LOGGER.finer(MessageKeys.ASYNC_RETRY, identityHash(), String.valueOf(waitTime),
requestParams.call, requestParams.namespace, requestParams.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void afterFiberStarted_timeoutStepScheduled() {
public void afterTimeout_newRequestSent() {
callFactory.clearRequest();

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

assertTrue(callFactory.invokedWith(requestParams));
}
Expand Down Expand Up @@ -158,22 +158,14 @@ public void afterFailedCallback_retrySentAfterDelay() {

@Test
public void afterMultipleRetriesAndSuccessfulCallback_nextStepAppliedWithValue() {
sendMultipleFailedCallback(0, 2);
sendMultipleFailedCallbackWithSetTime(0, 2);
testSupport.schedule(() -> callFactory.sendSuccessfulCallback(smallList));
assertThat(nextStep.result, equalTo(smallList));
}

@SuppressWarnings("SameParameterValue")
private void sendMultipleFailedCallback(int statusCode, int maxRetries) {
for (int retryCount = 0; retryCount < maxRetries; retryCount++) {
testSupport.schedule(
() -> callFactory.sendFailedCallback(new ApiException("test failure"), statusCode));
}
}

@Test
public void afterRetriesExhausted_fiberTerminatesWithException() {
sendMultipleFailedCallback(0, 3);
sendMultipleFailedCallbackWithSetTime(0, 3);

testSupport.verifyCompletionThrowable(FailureStatusSourceException.class);
}
Expand Down