Skip to content

Commit ed294b3

Browse files
committed
client: do not retry transparently if RPC committed or finished
1 parent 7567a5d commit ed294b3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stream.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,10 @@ func (cs *clientStream) commitAttempt() {
534534
// the error that should be returned by the operation. If the RPC should be
535535
// retried, the bool indicates whether it is being retried transparently.
536536
func (cs *clientStream) shouldRetry(err error) (bool, error) {
537+
if cs.finished || cs.committed {
538+
// RPC is finished or committed; cannot retry.
539+
return false, err
540+
}
537541
if cs.attempt.s == nil {
538542
// Error from NewClientStream.
539543
nse, ok := err.(*transport.NewStreamError)
@@ -559,10 +563,6 @@ func (cs *clientStream) shouldRetry(err error) (bool, error) {
559563
return true, nil
560564
}
561565
}
562-
if cs.finished || cs.committed {
563-
// RPC is finished or committed; cannot retry.
564-
return false, err
565-
}
566566
// Wait for the trailers.
567567
unprocessed := false
568568
if cs.attempt.s != nil {

0 commit comments

Comments
 (0)