Skip to content

Solve 1.93 performance issue #1432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1842,7 +1842,7 @@
"istextorbinary": "^6.0.0",
"minimatch": "^9.0.3",
"node-cmd": "^5.0.0",
"node-fetch-cjs": "3.1.1",
"node-fetch-cjs": "^3.3.2",
"vscode-cache": "^0.3.0",
"@vscode/debugadapter": "^1.61.0",
"@vscode/debugprotocol": "^1.61.0",
Expand Down
20 changes: 14 additions & 6 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface ConnectionSettings {

export class AtelierAPI {
private _config: ConnectionSettings;
private _agent?: httpModule.Agent | httpsModule.Agent;
private namespace: string;
public configName: string;

Expand Down Expand Up @@ -303,11 +304,18 @@ export class AtelierAPI {

const proto = this._config.https ? "https" : "http";
const http = this._config.https ? httpsModule : httpModule;
const agent = new http.Agent({
keepAlive: true,
maxSockets: 10,
rejectUnauthorized: https && vscode.workspace.getConfiguration("http").get("proxyStrictSSL"),
});
if (!this._agent) {
this._agent = new http.Agent({
/* VS Code 1.93 adopted a version of vscode-proxy-agent that fixed a failure to pass-through the keepAlive option (see https://github.com/microsoft/vscode/issues/173861 and https://github.com/microsoft/vscode-proxy-agent/commit/4eddc930d4fbc6b88ca5557ea7af07d623d390d6)
* This caused poor performance on some operations by our extension (see https://github.com/intersystems-community/vscode-objectscript/issues/1428)
* Short term solution adopted by PR https://github.com/intersystems-community/vscode-objectscript/pull/1432 is not to enable keepAlive
* We should revisit this in the future - TODO
*/
//keepAlive: true,
//maxSockets: 10,
rejectUnauthorized: https && vscode.workspace.getConfiguration("http").get("proxyStrictSSL"),
});
}

let pathPrefix = this._config.pathPrefix || "";
if (pathPrefix.length && !pathPrefix.startsWith("/")) {
Expand Down Expand Up @@ -340,7 +348,7 @@ export class AtelierAPI {
const cookie = await auth;
const response = await fetch(`${proto}://${host}:${port}${path}`, {
method,
agent,
agent: this._agent,
body: body ? (typeof body !== "string" ? JSON.stringify(body) : body) : null,
headers: {
...headers,
Expand Down
Loading