Change delay for hedging retry after a non-fatal error to be 0 to match the gRFC A6. (#10293)

Fixes #10145
This commit is contained in:
Larry Safran 2023-06-21 21:53:02 +00:00 committed by GitHub
parent 31321562ee
commit f1de820c19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -1067,6 +1067,10 @@ abstract class RetriableStream<ReqT> implements ClientStream {
isThrottled = !throttle.onQualifiedFailureThenCheckIsAboveThreshold(); isThrottled = !throttle.onQualifiedFailureThenCheckIsAboveThreshold();
} }
} }
if (!isFatal && !isThrottled && !status.isOk()
&& (pushbackMillis != null && pushbackMillis > 0)) {
pushbackMillis = 0; // We want the retry after a nonfatal error to be immediate
}
return new HedgingPlan(!isFatal && !isThrottled, pushbackMillis); return new HedgingPlan(!isFatal && !isThrottled, pushbackMillis);
} }

View File

@ -2518,7 +2518,7 @@ public class RetriableStreamTest {
Status.fromCode(NON_FATAL_STATUS_CODE_1), PROCESSED, headers); Status.fromCode(NON_FATAL_STATUS_CODE_1), PROCESSED, headers);
fakeClock.forwardTime(HEDGING_DELAY_IN_SECONDS, TimeUnit.SECONDS); fakeClock.forwardTime(HEDGING_DELAY_IN_SECONDS, TimeUnit.SECONDS);
inOrder.verifyNoMoreInteractions(); inOrder.verify(retriableStreamRecorder).newSubstream(anyInt());
fakeClock.forwardTime(1, TimeUnit.SECONDS); fakeClock.forwardTime(1, TimeUnit.SECONDS);
assertEquals(1, fakeClock.numPendingTasks()); assertEquals(1, fakeClock.numPendingTasks());