File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
packages/middleware-retry/src Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,17 @@ export class StandardRetryStrategy implements RetryStrategy {
91
91
) ;
92
92
}
93
93
94
+ private async getMaxAttempts ( ) {
95
+ let maxAttemptsStr ;
96
+ try {
97
+ maxAttemptsStr = await this . maxAttemptsProvider ( ) ;
98
+ } catch ( error ) {
99
+ maxAttemptsStr = "3" ;
100
+ }
101
+ const maxAttempts = parseInt ( maxAttemptsStr ) ;
102
+ return Number . isNaN ( maxAttempts ) ? 3 : maxAttempts ;
103
+ }
104
+
94
105
async retry < Input extends object , Ouput extends MetadataBearer > (
95
106
next : FinalizeHandler < Input , Ouput > ,
96
107
args : FinalizeHandlerArguments < Input >
@@ -99,16 +110,7 @@ export class StandardRetryStrategy implements RetryStrategy {
99
110
let attempts = 0 ;
100
111
let totalDelay = 0 ;
101
112
102
- const maxAttempts = await ( async ( ) => {
103
- let maxAttemptsStr ;
104
- try {
105
- maxAttemptsStr = await this . maxAttemptsProvider ( ) ;
106
- } catch ( error ) {
107
- maxAttemptsStr = "3" ;
108
- }
109
- const maxAttempts = parseInt ( maxAttemptsStr ) ;
110
- return Number . isNaN ( maxAttempts ) ? 3 : maxAttempts ;
111
- } ) ( ) ;
113
+ const maxAttempts = await this . getMaxAttempts ( ) ;
112
114
113
115
const { request } = args ;
114
116
if ( HttpRequest . isInstance ( request ) ) {
You can’t perform that action at this time.
0 commit comments