@@ -243,10 +243,8 @@ def commit(
243243 observability_options = getattr (database , "observability_options" , None ),
244244 metadata = metadata ,
245245 ) as span , MetricsCapture ():
246- nth_request = getattr (database , "_next_nth_request" , 0 )
247246
248247 def wrapped_method ():
249- attempt = AtomicCounter (0 )
250248 commit_request = CommitRequest (
251249 session = session .name ,
252250 mutations = mutations ,
@@ -255,12 +253,9 @@ def wrapped_method():
255253 max_commit_delay = max_commit_delay ,
256254 request_options = request_options ,
257255 )
258- # This code is retried due to ABORTED, hence nth_request
259- # should be increased. attempt can only be increased if
260- # we encounter UNAVAILABLE or INTERNAL.
261256 call_metadata , error_augmenter = database .with_error_augmentation (
262- nth_request ,
263- attempt . increment () ,
257+ getattr ( database , "_next_nth_request" , 0 ) ,
258+ 1 ,
264259 metadata ,
265260 span ,
266261 )
@@ -379,8 +374,6 @@ def batch_write(self, request_options=None, exclude_txn_from_change_streams=Fals
379374 observability_options = getattr (database , "observability_options" , None ),
380375 metadata = metadata ,
381376 ) as span , MetricsCapture ():
382- attempt = AtomicCounter (0 )
383- nth_request = getattr (database , "_next_nth_request" , 0 )
384377
385378 def wrapped_method ():
386379 batch_write_request = BatchWriteRequest (
@@ -393,8 +386,8 @@ def wrapped_method():
393386 api .batch_write ,
394387 request = batch_write_request ,
395388 metadata = database .metadata_with_request_id (
396- nth_request ,
397- attempt . increment () ,
389+ getattr ( database , "_next_nth_request" , 0 ) ,
390+ 1 ,
398391 metadata ,
399392 span ,
400393 ),
0 commit comments