Skip to content
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

Fix: add BspProxy connections dispose method #1543

Merged
merged 1 commit into from
Aug 1, 2024
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
6 changes: 6 additions & 0 deletions extension/src/bs/BspProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,10 @@ export class BspProxy {
// TODO: Implement more specific error handling logic here
});
}

public closeConnection(): void {
this.buildServerConnector.close();
this.jdtlsImporterConnector.close();
this.logger.info("Build Server connection closed");
}
}
6 changes: 6 additions & 0 deletions extension/src/bs/BuildServerConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ export class BuildServerConnector {
public getServerPipePath(): string {
return this.serverPipePath;
}

public close(): void {
this.serverConnection?.end();
this.serverConnection?.dispose();
this.serverPipeServer.close();
}
}
6 changes: 6 additions & 0 deletions extension/src/bs/JdtlsImporterConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@ export class JdtlsImporterConnector {
public getImporterConnection(): rpc.MessageConnection | null {
return this.importerConnection;
}

public close(): void {
this.importerConnection?.end();
this.importerConnection?.dispose();
this.importerPipeServer.close();
}
}
2 changes: 2 additions & 0 deletions extension/src/server/GradleServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
this._onDidStop.fire(null);
this.ready = false;
this.process?.removeAllListeners();
this.bspProxy.closeConnection();
if (this.restarting) {
this.restarting = false;
await this.start();
Expand Down Expand Up @@ -141,7 +142,7 @@

private async killProcess(): Promise<void> {
if (this.process) {
return new Promise((resolve, _reject) => {

Check warning on line 145 in extension/src/server/GradleServer.ts

View workflow job for this annotation

GitHub Actions / Build & Analyse

'_reject' is defined but never used
if (this.process?.pid) {
kill(this.process.pid, () => resolve);
}
Expand All @@ -163,6 +164,7 @@
}

public async asyncDispose(): Promise<void> {
this.bspProxy.closeConnection();
this.process?.removeAllListeners();
await this.killProcess();
this.ready = false;
Expand Down
Loading