@@ -138,19 +138,12 @@ class AleoNetworkClient {
138
138
*/
139
139
async fetchData < Type > ( url = "/" ) : Promise < Type > {
140
140
try {
141
- const raw = await retryWithBackoff ( ( ) => this . fetchRaw ( url ) , {
142
- retryOnStatus : [ 500 , 502 , 503 , 504 ] ,
143
- shouldRetry : ( err ) => {
144
- const msg = err ?. message ?. toLowerCase ?.( ) || "" ;
145
- return msg . includes ( "network" ) || msg . includes ( "timeout" ) || msg . includes ( "503" ) ;
146
- }
147
- } ) ;
141
+ const raw = await retryWithBackoff ( ( ) => this . fetchRaw ( url ) ) ;
148
142
return parseJSON ( raw ) ;
149
143
} catch ( error ) {
150
144
throw new Error ( `Error fetching data: ${ error } ` ) ;
151
145
}
152
146
}
153
-
154
147
155
148
/**
156
149
* Fetches data from the Aleo network and returns it as an unparsed string.
@@ -163,17 +156,16 @@ class AleoNetworkClient {
163
156
async fetchRaw ( url = "/" ) : Promise < string > {
164
157
try {
165
158
return await retryWithBackoff ( async ( ) => {
166
- const response = await get ( this . host + url , {
167
- headers : this . headers ,
168
- } ) ;
169
- return await response . text ( ) ;
170
- } , {
171
- retryOnStatus : [ 500 , 502 , 503 , 504 ] ,
172
- shouldRetry : ( err ) => {
173
- const msg = err ?. message ?. toLowerCase ?.( ) || "" ;
174
- return msg . includes ( "network" ) || msg . includes ( "timeout" ) || msg . includes ( "503" ) ;
175
- }
176
- } ) ;
159
+ const response = await get ( this . host + url , {
160
+ headers : this . headers ,
161
+ } ) ;
162
+ return await response . text ( ) ;
163
+ } , {
164
+ shouldRetry : ( err ) => {
165
+ const msg = err ?. message ?. toLowerCase ?.( ) || "" ;
166
+ return msg . includes ( "network" ) || msg . includes ( "timeout" ) ;
167
+ }
168
+ } ) ;
177
169
} catch ( error ) {
178
170
throw new Error ( `Error fetching data: ${ error } ` ) ;
179
171
}
0 commit comments