File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ export interface ConnectionSettings {
43
43
44
44
export class AtelierAPI {
45
45
private _config : ConnectionSettings ;
46
+ private _agent ?: httpModule . Agent | httpsModule . Agent ;
46
47
private namespace : string ;
47
48
public configName : string ;
48
49
@@ -303,11 +304,13 @@ export class AtelierAPI {
303
304
304
305
const proto = this . _config . https ? "https" : "http" ;
305
306
const http = this . _config . https ? httpsModule : httpModule ;
306
- const agent = new http . Agent ( {
307
- keepAlive : true ,
308
- maxSockets : 10 ,
309
- rejectUnauthorized : https && vscode . workspace . getConfiguration ( "http" ) . get ( "proxyStrictSSL" ) ,
310
- } ) ;
307
+ if ( ! this . _agent ) {
308
+ this . _agent = new http . Agent ( {
309
+ keepAlive : true ,
310
+ maxSockets : 10 ,
311
+ rejectUnauthorized : https && vscode . workspace . getConfiguration ( "http" ) . get ( "proxyStrictSSL" ) ,
312
+ } ) ;
313
+ }
311
314
312
315
let pathPrefix = this . _config . pathPrefix || "" ;
313
316
if ( pathPrefix . length && ! pathPrefix . startsWith ( "/" ) ) {
@@ -340,7 +343,7 @@ export class AtelierAPI {
340
343
const cookie = await auth ;
341
344
const response = await fetch ( `${ proto } ://${ host } :${ port } ${ path } ` , {
342
345
method,
343
- agent,
346
+ agent : this . _agent ,
344
347
body : body ? ( typeof body !== "string" ? JSON . stringify ( body ) : body ) : null ,
345
348
headers : {
346
349
...headers ,
You can’t perform that action at this time.
0 commit comments