@@ -71,15 +71,6 @@ fn impl_inner_call_impl_err(
7171) -> Result < ( ) , Error > {
7272 let failed_attempts = errors. len ( ) + 1 ;
7373
74- if retries_exhausted ( failed_attempts, self_. config . retry ( ) ) {
75- warn ! (
76- "call '{}' failed after {} attempts" ,
77- stringify!( $name) ,
78- failed_attempts
79- ) ;
80- return Err ( Error :: AllAttemptsErrored ( std:: mem:: take ( errors) ) ) ;
81- }
82-
8374 warn ! (
8475 "call '{}' failed with {}, retry: {}/{}" ,
8576 stringify!( $name) ,
@@ -90,6 +81,15 @@ fn impl_inner_call_impl_err(
9081
9182 errors. push ( e) ;
9283
84+ if retries_exhausted ( failed_attempts, self_. config . retry ( ) ) {
85+ warn ! (
86+ "call '{}' failed after {} attempts" ,
87+ stringify!( $name) ,
88+ failed_attempts
89+ ) ;
90+ return Err ( Error :: AllAttemptsErrored ( std:: mem:: take ( errors) ) ) ;
91+ }
92+
9393 // Only one thread will try to recreate the client getting the write lock,
9494 // other eventual threads will get Err and will block at the beginning of
9595 // previous loop when trying to read()
@@ -107,14 +107,6 @@ fn impl_inner_call_impl_err(
107107 Err ( e) => {
108108 let failed_attempts = errors. len ( ) + 1 ;
109109
110- if retries_exhausted ( failed_attempts, self_. config . retry ( ) ) {
111- warn ! (
112- "re-creating client failed after {} attempts" ,
113- failed_attempts
114- ) ;
115- return Err ( Error :: AllAttemptsErrored ( std:: mem:: take ( errors) ) ) ;
116- }
117-
118110 warn ! (
119111 "re-creating client failed with {}, retry: {}/{}" ,
120112 e,
@@ -123,6 +115,14 @@ fn impl_inner_call_impl_err(
123115 ) ;
124116
125117 errors. push ( e) ;
118+
119+ if retries_exhausted ( failed_attempts, self_. config . retry ( ) ) {
120+ warn ! (
121+ "re-creating client failed after {} attempts" ,
122+ failed_attempts
123+ ) ;
124+ return Err ( Error :: AllAttemptsErrored ( std:: mem:: take ( errors) ) ) ;
125+ }
126126 }
127127 }
128128 }
0 commit comments