Skip to content

Commit

Permalink
client: do not retry transparently if RPC committed or finished
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley committed Apr 26, 2022
1 parent 7567a5d commit ed294b3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,10 @@ func (cs *clientStream) commitAttempt() {
// the error that should be returned by the operation. If the RPC should be
// retried, the bool indicates whether it is being retried transparently.
func (cs *clientStream) shouldRetry(err error) (bool, error) {
if cs.finished || cs.committed {
// RPC is finished or committed; cannot retry.
return false, err
}
if cs.attempt.s == nil {
// Error from NewClientStream.
nse, ok := err.(*transport.NewStreamError)
Expand All @@ -559,10 +563,6 @@ func (cs *clientStream) shouldRetry(err error) (bool, error) {
return true, nil
}
}
if cs.finished || cs.committed {
// RPC is finished or committed; cannot retry.
return false, err
}
// Wait for the trailers.
unprocessed := false
if cs.attempt.s != nil {
Expand Down

0 comments on commit ed294b3

Please sign in to comment.