Skip to content

Commit

Permalink
fix: Add axios-retry to retry request automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
Kesin11 committed Nov 13, 2020
1 parent 3831c04 commit c6c6d86
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@octokit/rest": "18.0.9",
"adm-zip": "0.4.16",
"axios": "0.21.0",
"axios-retry": "3.1.9",
"dayjs": "1.9.6",
"js-yaml": "3.14.0",
"junit2json": "2.0.1",
Expand Down
5 changes: 5 additions & 0 deletions src/client/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios, { AxiosRequestConfig } from 'axios'
import axiosRetry from 'axios-retry'

export type Artifact = {
path: string
Expand All @@ -15,6 +16,10 @@ export const createAxios = (config: AxiosRequestConfig) => {
// Overwrite parameters
...config
});
axiosRetry(axiosInstance, {
retries: 3,
retryDelay: axiosRetry.exponentialDelay
})

if (process.env['CI_ANALYZER_DEBUG']) {
axiosInstance.interceptors.request.use(axiosRequestLogger)
Expand Down

0 comments on commit c6c6d86

Please sign in to comment.