File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,7 +143,17 @@ export async function SearchAllAsync(groupName: string): SearchAllResponse {
143143// TODO: do not directly use axios.create from within a function like this
144144// it will cause a new client to be made per request.
145145const httpClient = axios . create ( ) ;
146- axiosRetry ( httpClient , { retries : 5 } ) ;
146+ axiosRetry ( httpClient , {
147+ retries : 5 ,
148+ retryDelay : ( retryCount ) => {
149+ Log ( `Retry attempt: ${ retryCount } ` ) ;
150+ return retryCount * 2000 ;
151+ } ,
152+ retryCondition : ( error :any ) => {
153+ // if retry condition is not specified, by default idempotent requests are retried
154+ return error . response . status < 200 || error . response . status > 299 ;
155+ }
156+ } ) ;
147157
148158async function ForwardSearch ( groupName : string ) : SearchAllResponse {
149159 Log ( `Forwarding request to '${ process . env . SOURCE_PROXY } '` ) ;
@@ -154,7 +164,10 @@ async function ForwardSearch(groupName: string) : SearchAllResponse {
154164 try {
155165 const result = await httpClient . get ( requestUrl ) ;
156166 Log ( `Results for ${ groupName } : ${ result } ` ) ;
157- return result . data as SearchAllResponse ;
167+ return {
168+ Succeeded : true ,
169+ ...result . data
170+ }
158171 }
159172 catch ( e ) {
160173 Log ( `Error when retrieving results for ${ groupName } : ${ e } ` ) ;
You can’t perform that action at this time.
0 commit comments