mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-24 07:38:12 -05:00
feat: new setting - maxsockets (#3889)
This commit is contained in:
5
.changeset/silent-tables-reflect.md
Normal file
5
.changeset/silent-tables-reflect.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/store-connection-manager": minor
|
||||
---
|
||||
|
||||
Make the maximum amount of sockets configurable through the `maxSockets` option.
|
||||
5
.changeset/swift-readers-repeat.md
Normal file
5
.changeset/swift-readers-repeat.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/config": minor
|
||||
---
|
||||
|
||||
New setting supported: maxsockets. maxsockets allows to set the maximum number of connections to use per origin (protocol/host/post combination).
|
||||
@@ -96,6 +96,7 @@ export interface Config {
|
||||
storeDir?: string
|
||||
virtualStoreDir?: string
|
||||
verifyStoreIntegrity?: boolean
|
||||
maxSockets?: number
|
||||
networkConcurrency?: number
|
||||
fetchingConcurrency?: number
|
||||
lockfileOnly?: boolean // like npm's --package-lock-only
|
||||
|
||||
@@ -66,6 +66,7 @@ export const types = Object.assign({
|
||||
'lockfile-directory': String, // TODO: deprecate
|
||||
'lockfile-only': Boolean,
|
||||
loglevel: ['silent', 'error', 'warn', 'info', 'debug'],
|
||||
maxsockets: Number,
|
||||
'modules-cache-max-age': Number,
|
||||
'modules-dir': String,
|
||||
'network-concurrency': Number,
|
||||
@@ -224,6 +225,10 @@ export default async (
|
||||
...Object.entries(cliOptions).filter(([name, value]) => typeof value !== 'undefined').map(([name, value]) => [camelcase(name), value]),
|
||||
]) as unknown as ConfigWithDeprecatedSettings
|
||||
const cwd = (cliOptions.dir && path.resolve(cliOptions.dir)) ?? npmConfig.localPrefix
|
||||
|
||||
pnpmConfig.maxSockets = npmConfig.maxsockets
|
||||
delete pnpmConfig['maxsockets']
|
||||
|
||||
pnpmConfig.workspaceDir = opts.workspaceDir
|
||||
pnpmConfig.workspaceRoot = cliOptions['workspace-root'] as boolean // This is needed to prevent pnpm reading workspaceRoot from env variables
|
||||
pnpmConfig.rawLocalConfig = Object.assign.apply(Object, [
|
||||
|
||||
@@ -26,6 +26,7 @@ export type CreateNewStoreControllerOptions = CreateResolverOptions & Pick<Confi
|
||||
| 'httpsProxy'
|
||||
| 'key'
|
||||
| 'localAddress'
|
||||
| 'maxSockets'
|
||||
| 'networkConcurrency'
|
||||
| 'noProxy'
|
||||
| 'offline'
|
||||
@@ -64,9 +65,11 @@ export default async (
|
||||
strictSsl: opts.strictSsl ?? true,
|
||||
timeout: opts.fetchTimeout,
|
||||
userAgent: opts.userAgent,
|
||||
maxSockets: opts.networkConcurrency != null
|
||||
? (opts.networkConcurrency * 3)
|
||||
: undefined,
|
||||
maxSockets: opts.maxSockets ?? (
|
||||
opts.networkConcurrency != null
|
||||
? (opts.networkConcurrency * 3)
|
||||
: undefined
|
||||
),
|
||||
})
|
||||
await fs.mkdir(opts.storeDir, { recursive: true })
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user