Skip to content

Commit

Permalink
fix: assign the keep-alive value explicitly (#1368)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
gauthier-th authored Feb 17, 2025
1 parent c181cee commit 438ccfe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/utils/customProxyAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -63,6 +63,7 @@ export default async function createCustomProxyAgent(
interceptors: {
Client: [noProxyInterceptor],
},
keepAliveTimeout: 5000,
});

setGlobalDispatcher(proxyAgent);
Expand Down

0 comments on commit 438ccfe

Please sign in to comment.