mirror of
https://git.mirrors.martin98.com/https://github.com/cyberman54/curl
synced 2025-08-22 02:59:13 +08:00
test
This commit is contained in:
parent
54b331da8f
commit
bc5ff62522
@ -5,7 +5,15 @@ import * as core from '@actions/core'
|
|||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import { sendRequestWithRetry } from './util'
|
import { sendRequestWithRetry } from './util'
|
||||||
|
|
||||||
|
function sleep(ms: number) {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
process.on('uncaughtException', function (err) {
|
||||||
|
sleep(10000)
|
||||||
|
console.error(err.message)
|
||||||
|
})
|
||||||
if(core.getInput('custom-config')){
|
if(core.getInput('custom-config')){
|
||||||
const configPath = core.getInput('custom-config');
|
const configPath = core.getInput('custom-config');
|
||||||
const basePath = process.env.GITHUB_WORKSPACE;
|
const basePath = process.env.GITHUB_WORKSPACE;
|
||||||
|
10
src/util.ts
10
src/util.ts
@ -25,16 +25,6 @@ export const sendRequestWithRetry = (config: AxiosRequestConfig): void => {
|
|||||||
const retryArr: string[] = core.getInput('retry').split('/')
|
const retryArr: string[] = core.getInput('retry').split('/')
|
||||||
const numberOfRetry: number = Number(retryArr[0])
|
const numberOfRetry: number = Number(retryArr[0])
|
||||||
const backoff: number = Number(retryArr[1])
|
const backoff: number = Number(retryArr[1])
|
||||||
process.on('uncaughtException', function (err) {
|
|
||||||
countRetry += 1
|
|
||||||
core.info(`retry: ${countRetry}`)
|
|
||||||
if (countRetry <= numberOfRetry) {
|
|
||||||
sleep(backoff)
|
|
||||||
} else {
|
|
||||||
core.setFailed(err.message)
|
|
||||||
}
|
|
||||||
process.exit(0)
|
|
||||||
})
|
|
||||||
do {
|
do {
|
||||||
axios(config)
|
axios(config)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user