From 0d732cc87b432589f156c96d430e13c792dceeeb Mon Sep 17 00:00:00 2001 From: Scott Parkerson Date: Thu, 5 Sep 2024 14:45:30 -0400 Subject: [PATCH] fix(datastore): do not delay on final transaction attempt (#10824) --- datastore/transaction.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/datastore/transaction.go b/datastore/transaction.go index 309ade4fe9dd..710275dba0df 100644 --- a/datastore/transaction.go +++ b/datastore/transaction.go @@ -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 {