提交 732824c3 编写于 作者: M Matt Bierner

Fixing TSServer Restart Happening Twice

Fixes #27817

**Bug**
When triggering a manual TSServer restart, we currently start a new instance than immediatly kill it and start another new instance of the service. This is caused by the current handler for proces crashes not knowing that it should not restart the service for manual restarts.

**Fix**
Make sure kill doesn't automatically try to start up another instance of the TS Server when we manually restart the server
上级 9f99d4ea
......@@ -240,6 +240,8 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
private firstStart: number;
private lastStart: number;
private numberRestarts: number;
private isRestarting: boolean = false;
private cancellationPipeName: string | null = null;
private requestQueue: RequestQueue;
......@@ -305,13 +307,14 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
public restartTsServer(): void {
const start = () => {
this.servicePromise = this.startService();
this.servicePromise = this.startService(true);
return this.servicePromise;
};
if (this.servicePromise) {
this.servicePromise = this.servicePromise.then(cp => {
if (cp) {
this.isRestarting = true;
cp.kill();
}
}).then(start);
......@@ -352,7 +355,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
return this._onReady.promise;
}
public info(message: string, data?: any): void {
private info(message: string, data?: any): void {
this.logger.info(message, data);
}
......@@ -360,7 +363,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
this.logger.warn(message, data);
}
public error(message: string, data?: any): void {
private error(message: string, data?: any): void {
this.logger.error(message, data);
}
......@@ -567,7 +570,8 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
if (this.tsServerLogFile) {
this.info(`TSServer log file: ${this.tsServerLogFile}`);
}
this.serviceExited(true);
this.serviceExited(!this.isRestarting);
this.isRestarting = false;
});
this.reader = new Reader<Proto.Response>(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册