This commit is contained in:
Wathanyu Phromma 2020-05-29 20:03:22 +07:00
parent 78b1d4b623
commit f459a802ec

View File

@ -26,12 +26,16 @@ export const sendRequestWithRetry = (config: AxiosRequestConfig): void => {
const numberOfRetry: number = Number(retryArr[0])
const backoff: number = Number(retryArr[1])
do{
try{
axios(config)
.then(res => {
exit = true
setOutput(res)
})
.catch(err => {
throw new Error(err)
})
}catch(err){
countRetry += 1
core.info(`retry: ${countRetry}`)
if(countRetry <= numberOfRetry){
@ -40,7 +44,7 @@ export const sendRequestWithRetry = (config: AxiosRequestConfig): void => {
exit = true
core.setFailed(err)
}
})
}
}while(!exit)
}