mirror of
https://git.mirrors.martin98.com/https://github.com/cyberman54/curl
synced 2025-08-22 08:29:08 +08:00
test
This commit is contained in:
parent
6b2988f68d
commit
f1432d9eda
16
src/util.ts
16
src/util.ts
@ -25,18 +25,22 @@ export const sendRequestWithRetry = (config: AxiosRequestConfig): void => {
|
||||
const retryArr: string[] = core.getInput('retry').split('/')
|
||||
const numberOfRetry: number = Number(retryArr[0])
|
||||
const backoff: number = Number(retryArr[1])
|
||||
core.debug(`retry: ${countRetry}`)
|
||||
process.on('uncaughtException', function (err) {
|
||||
countRetry += 1
|
||||
core.info(`retry: ${countRetry}`)
|
||||
if (countRetry <= numberOfRetry) {
|
||||
sleep(backoff)
|
||||
} else {
|
||||
core.setFailed(err.message)
|
||||
}
|
||||
})
|
||||
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) {
|
||||
@ -45,7 +49,7 @@ export const sendRequestWithRetry = (config: AxiosRequestConfig): void => {
|
||||
exit = true
|
||||
core.setFailed(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
} while (!exit)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user