From ccf969195ed04f4edbbabece6956d1b29a7e1ba9 Mon Sep 17 00:00:00 2001 From: lusyn Date: Mon, 11 Dec 2023 12:09:28 +0800 Subject: [PATCH] feat: add max connections --- src/HttpAgent.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/HttpAgent.ts b/src/HttpAgent.ts index 0fff0886..402473dd 100644 --- a/src/HttpAgent.ts +++ b/src/HttpAgent.ts @@ -6,6 +6,8 @@ import { buildConnector, } from 'undici'; +const MAX_CONNECTIONS = 1000; + export type CheckAddressFunction = (ip: string, family: number | string) => boolean; export type HttpAgentOptions = { @@ -63,6 +65,7 @@ export class HttpAgent extends Agent { }; super({ connect: { ...options.connect, lookup }, + connections: MAX_CONNECTIONS, }); this.#checkAddress = options.checkAddress; }