From 438ccfe9c37f4848b84e60a2ce64687e0b4e4dc0 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Mon, 17 Feb 2025 20:48:37 +0100 Subject: [PATCH] fix: assign the keep-alive value explicitly (#1368) * fix: assign the keep-alive value explicitly The Node.js documentation mentions that the default keep-alive value is not used when creating a global agent manually, which is done in customProxyAgent.ts. re #1365 * fix: typo --- server/utils/customProxyAgent.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/utils/customProxyAgent.ts b/server/utils/customProxyAgent.ts index 3b6223685..96ea7fed7 100644 --- a/server/utils/customProxyAgent.ts +++ b/server/utils/customProxyAgent.ts @@ -6,7 +6,7 @@ import { Agent, ProxyAgent, setGlobalDispatcher } from 'undici'; export default async function createCustomProxyAgent( proxySettings: ProxySettings ) { - const defaultAgent = new Agent(); + const defaultAgent = new Agent({ keepAliveTimeout: 5000 }); const skipUrl = (url: string) => { const hostname = new URL(url).hostname; @@ -63,6 +63,7 @@ export default async function createCustomProxyAgent( interceptors: { Client: [noProxyInterceptor], }, + keepAliveTimeout: 5000, }); setGlobalDispatcher(proxyAgent);