Skip to content

Commit

Permalink
Remove axios-concurrency (#1048)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kesin11 authored Nov 25, 2023
2 parents abdc265 + 0eacf42 commit 0847400
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 53 deletions.
35 changes: 0 additions & 35 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"@octokit/rest": "20.0.2",
"adm-zip": "0.5.10",
"axios": "1.6.2",
"axios-concurrency": "1.0.4",
"axios-retry": "3.9.1",
"dayjs": "1.11.10",
"js-yaml": "4.1.0",
Expand Down
8 changes: 0 additions & 8 deletions src/@types/axios-concurrency.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/arg_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ export class ArgumentOptions {
this.keepAlive = argv['keepalive'] as boolean
this.maxConcurrentRequests = (argv['max-concurrent-requests'] as number > 0)
? argv['max-concurrent-requests'] as number
: undefined
: undefined // When user set 0, yargs parse to undefined
}
}
13 changes: 6 additions & 7 deletions src/client/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import axios, { AxiosRequestConfig, InternalAxiosRequestConfig } from 'axios'
import axiosRetry from 'axios-retry'
import { ConcurrencyManager } from 'axios-concurrency'
import http from 'http'
import https from 'https'
import { Logger } from 'tslog'
Expand All @@ -18,8 +17,12 @@ export const createAxios = (logger: Logger<unknown>, options: ArgumentOptions, c
const axiosInstance = axios.create({
// Default parameters
timeout: 5000,
httpAgent: (options.keepAlive) ? new http.Agent({ keepAlive: true }) : undefined,
httpsAgent:(options.keepAlive) ? new https.Agent({ keepAlive: true }) : undefined,
httpAgent: (options.keepAlive || options.maxConcurrentRequests )
? new http.Agent({ keepAlive: true, maxSockets: options.maxConcurrentRequests })
: undefined,
httpsAgent:(options.keepAlive || options.maxConcurrentRequests )
? new https.Agent({ keepAlive: true, maxSockets: options.maxConcurrentRequests })
: undefined,

// Overwrite parameters
...config
Expand Down Expand Up @@ -50,10 +53,6 @@ export const createAxios = (logger: Logger<unknown>, options: ArgumentOptions, c
return Promise.reject(error)
})

if (options.maxConcurrentRequests) {
ConcurrencyManager(axiosInstance, options.maxConcurrentRequests)
}

return axiosInstance
}

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
"typeRoots": ["src/@types", "node_modules/@types"], /* List of folders to include type definitions from. */
// "typeRoots": ["src/@types", "node_modules/@types"], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
Expand Down

0 comments on commit 0847400

Please sign in to comment.