Skip to content

Commit

Permalink
fix(datastore): do not delay on final transaction attempt (#10824)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgp authored Sep 5, 2024
1 parent 40229e6 commit 0d732cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions datastore/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,11 @@ func (c *Client) RunInTransaction(ctx context.Context, f func(tx *Transaction) e
return nil, err
}

// If this is the last attempt, exit without delaying.
if n+1 == settings.attempts {
return nil, err
}

// Check if error should be retried
code, errConvert := grpcStatusCode(retryErr)
if errConvert != nil && code == codes.ResourceExhausted {
Expand Down

0 comments on commit 0d732cc

Please sign in to comment.