@@ -461,6 +461,7 @@ def run_in_transaction(self, func, *args, **kw):
461461 reraises any non-ABORT exceptions raised by ``func``.
462462 """
463463 deadline = time .time () + kw .pop ("timeout_secs" , DEFAULT_RETRY_TIMEOUT_SECS )
464+ default_retry_delay = kw .pop ("default_retry_delay" , None )
464465 commit_request_options = kw .pop ("commit_request_options" , None )
465466 max_commit_delay = kw .pop ("max_commit_delay" , None )
466467 transaction_tag = kw .pop ("transaction_tag" , None )
@@ -502,7 +503,11 @@ def run_in_transaction(self, func, *args, **kw):
502503 except Aborted as exc :
503504 del self ._transaction
504505 if span :
505- delay_seconds = _get_retry_delay (exc .errors [0 ], attempts )
506+ delay_seconds = _get_retry_delay (
507+ exc .errors [0 ],
508+ attempts ,
509+ default_retry_delay = default_retry_delay ,
510+ )
506511 attributes = dict (delay_seconds = delay_seconds , cause = str (exc ))
507512 attributes .update (span_attributes )
508513 add_span_event (
@@ -511,7 +516,9 @@ def run_in_transaction(self, func, *args, **kw):
511516 attributes ,
512517 )
513518
514- _delay_until_retry (exc , deadline , attempts )
519+ _delay_until_retry (
520+ exc , deadline , attempts , default_retry_delay = default_retry_delay
521+ )
515522 continue
516523 except GoogleAPICallError :
517524 del self ._transaction
@@ -539,7 +546,11 @@ def run_in_transaction(self, func, *args, **kw):
539546 except Aborted as exc :
540547 del self ._transaction
541548 if span :
542- delay_seconds = _get_retry_delay (exc .errors [0 ], attempts )
549+ delay_seconds = _get_retry_delay (
550+ exc .errors [0 ],
551+ attempts ,
552+ default_retry_delay = default_retry_delay ,
553+ )
543554 attributes = dict (delay_seconds = delay_seconds )
544555 attributes .update (span_attributes )
545556 add_span_event (
@@ -548,7 +559,9 @@ def run_in_transaction(self, func, *args, **kw):
548559 attributes ,
549560 )
550561
551- _delay_until_retry (exc , deadline , attempts )
562+ _delay_until_retry (
563+ exc , deadline , attempts , default_retry_delay = default_retry_delay
564+ )
552565 except GoogleAPICallError :
553566 del self ._transaction
554567 add_span_event (
0 commit comments