File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
src/platform/networking/node Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 6
6
import * as undici from 'undici' ;
7
7
import { IEnvService } from '../../env/common/envService' ;
8
8
import { BaseFetchFetcher } from './baseFetchFetcher' ;
9
+ import { Lazy } from '../../../util/vs/base/common/lazy' ;
9
10
10
11
export class NodeFetchFetcher extends BaseFetchFetcher {
11
12
@@ -32,6 +33,9 @@ export class NodeFetchFetcher extends BaseFetchFetcher {
32
33
function getFetch ( ) : typeof globalThis . fetch {
33
34
const fetch = ( globalThis as any ) . __vscodePatchedFetch || globalThis . fetch ;
34
35
return function ( input : string | URL | globalThis . Request , init ?: RequestInit ) {
35
- return fetch ( input , { dispatcher : new undici . Agent ( { allowH2 : true } ) , ...init } ) ;
36
+ return fetch ( input , { dispatcher : agent . value , ...init } ) ;
36
37
} ;
37
38
}
39
+
40
+ // Cache agent to reuse connections.
41
+ const agent = new Lazy ( ( ) => new undici . Agent ( { allowH2 : true } ) ) ;
You can’t perform that action at this time.
0 commit comments