Skip to content

Commit

Permalink
fix(datastore): do not delay on final transaction attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
sgp committed Aug 29, 2024
1 parent 897539d commit 0485b40
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 0485b40

Please sign in to comment.