Skip to content

Commit f1de820

Browse files
authored
Change delay for hedging retry after a non-fatal error to be 0 to match the gRFC A6. (#10293)
Fixes #10145
1 parent 3132156 commit f1de820

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/src/main/java/io/grpc/internal/RetriableStream.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,10 @@ private HedgingPlan makeHedgingDecision(Status status, Metadata trailer) {
10671067
isThrottled = !throttle.onQualifiedFailureThenCheckIsAboveThreshold();
10681068
}
10691069
}
1070+
if (!isFatal && !isThrottled && !status.isOk()
1071+
&& (pushbackMillis != null && pushbackMillis > 0)) {
1072+
pushbackMillis = 0; // We want the retry after a nonfatal error to be immediate
1073+
}
10701074
return new HedgingPlan(!isFatal && !isThrottled, pushbackMillis);
10711075
}
10721076

core/src/test/java/io/grpc/internal/RetriableStreamTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2518,7 +2518,7 @@ public void hedging_pushback_positive() {
25182518
Status.fromCode(NON_FATAL_STATUS_CODE_1), PROCESSED, headers);
25192519

25202520
fakeClock.forwardTime(HEDGING_DELAY_IN_SECONDS, TimeUnit.SECONDS);
2521-
inOrder.verifyNoMoreInteractions();
2521+
inOrder.verify(retriableStreamRecorder).newSubstream(anyInt());
25222522

25232523
fakeClock.forwardTime(1, TimeUnit.SECONDS);
25242524
assertEquals(1, fakeClock.numPendingTasks());

0 commit comments

Comments
 (0)