@@ -959,18 +959,11 @@ impl<D: AsyncDB, M: MakeConnection<Conn = D>> Runner<D, M> {
959959 & mut self ,
960960 record : Record < D :: ColumnType > ,
961961 ) -> Result < RecordOutput < D :: ColumnType > , TestError > {
962- let retry = match & record {
963- Record :: Statement { retry, .. } => retry. clone ( ) ,
964- Record :: Query { retry, .. } => retry. clone ( ) ,
965- Record :: System { retry, .. } => retry. clone ( ) ,
966- _ => None ,
967- } ;
968- if retry. is_none ( ) {
962+ // The parser ensures that `retry.attempts` must be > 0.
963+ let Some ( retry) = record. retry_config ( ) else {
969964 return self . run_async_no_retry ( record) . await ;
970- }
965+ } ;
971966
972- // Retry for `retry.attempts` times. The parser ensures that `retry.attempts` must > 0.
973- let retry = retry. unwrap ( ) ;
974967 let mut last_error = None ;
975968 for _ in 0 ..retry. attempts {
976969 let result = self . run_async_no_retry ( record. clone ( ) ) . await ;
@@ -1530,7 +1523,16 @@ impl<D: AsyncDB, M: MakeConnection<Conn = D>> Runner<D, M> {
15301523 ) ;
15311524 continue ;
15321525 }
1526+
1527+ // If a retry configuration is specified for the record, sleep for the maximum
1528+ // retry time.
1529+ if let Some ( config) = record. retry_config ( ) {
1530+ let max_duration = config. backoff * config. attempts . try_into ( ) ?;
1531+ D :: sleep ( max_duration) . await ;
1532+ }
1533+
15331534 let record_output = self . apply_record ( record. clone ( ) ) . await ;
1535+
15341536 let record = update_record_with_output (
15351537 & record,
15361538 & record_output,
0 commit comments