Avoid double restarts of the query server

Previously, if there was an explicit restart of the query server (eg-
by changing a configuration setting), then the query server process
would be started twice: once by the `close` handler and once by the
restart command.

By adding the `removeAllListeners` to the dispose method, we ensure that
when the query server shuts down gracefully, there won't be a `close`
listener that is going to restart it a second time if there is a
different way of restarting it.
This commit is contained in:
Andrew Eisenberg
2023-09-28 14:25:35 -07:00
parent 493e8d915e
commit 3999ae3728

View File

@@ -26,6 +26,7 @@ export class ServerProcess implements Disposable {
this.connection.end();
this.child.stdin!.end();
this.child.stderr!.destroy();
this.child.removeAllListeners();
// TODO kill the process if it doesn't terminate after a certain time limit.
// On Windows, we usually have to terminate the process before closing its stdout.