mirror of
https://git.mirrors.martin98.com/https://github.com/cyberman54/curl
synced 2026-04-06 05:53:14 +08:00
push
This commit is contained in:
@@ -10,10 +10,6 @@ function sleep(ms: number) {
|
||||
}
|
||||
|
||||
try {
|
||||
process.on('uncaughtException', function (err) {
|
||||
sleep(10000)
|
||||
console.error(err.message)
|
||||
})
|
||||
if(core.getInput('custom-config')){
|
||||
const configPath = core.getInput('custom-config');
|
||||
const basePath = process.env.GITHUB_WORKSPACE;
|
||||
|
||||
23
src/util.ts
23
src/util.ts
@@ -25,22 +25,27 @@ 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.info(`retry: ${countRetry}`)
|
||||
do {
|
||||
axios(config)
|
||||
try{
|
||||
axios(config)
|
||||
.then(res => {
|
||||
exit = true
|
||||
setOutput(res)
|
||||
})
|
||||
.catch(err => {
|
||||
countRetry += 1
|
||||
core.info(`retry: ${countRetry}`)
|
||||
if (countRetry <= numberOfRetry) {
|
||||
sleep(backoff)
|
||||
} else {
|
||||
exit = true
|
||||
core.setFailed(err)
|
||||
}
|
||||
throw new Error(err)
|
||||
})
|
||||
}catch(err){
|
||||
countRetry += 1
|
||||
core.info(`retry: ${countRetry}`)
|
||||
if (countRetry <= numberOfRetry) {
|
||||
sleep(backoff)
|
||||
} else {
|
||||
exit = true
|
||||
core.setFailed(err)
|
||||
}
|
||||
}
|
||||
} while (!exit)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user