mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 01:00:29 -04:00
VSCode merge (#4610)
* Merge from vscode e388c734f30757875976c7e326d6cfeee77710de * fix yarn lcoks * remove small issue
This commit is contained in:
@@ -27,6 +27,11 @@ import { IRemoteEnvironmentService } from 'vs/workbench/services/remote/common/r
|
||||
/** The amount of time to consider terminal errors to be related to the launch */
|
||||
const LAUNCHING_DURATION = 500;
|
||||
|
||||
/**
|
||||
* The minimum amount of time between latency requests.
|
||||
*/
|
||||
const LATENCY_MEASURING_INTERVAL = 1000;
|
||||
|
||||
/**
|
||||
* Holds all state related to the creation and management of terminal processes.
|
||||
*
|
||||
@@ -46,6 +51,9 @@ export class TerminalProcessManager implements ITerminalProcessManager {
|
||||
private _process: ITerminalChildProcess | null = null;
|
||||
private _preLaunchInputQueue: string[] = [];
|
||||
private _disposables: IDisposable[] = [];
|
||||
private _latency: number = -1;
|
||||
private _latencyRequest: Promise<number>;
|
||||
private _latencyLastMeasured: number = 0;
|
||||
|
||||
private readonly _onProcessReady = new Emitter<void>();
|
||||
public get onProcessReady(): Event<void> { return this._onProcessReady.event; }
|
||||
@@ -77,6 +85,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
|
||||
c(undefined);
|
||||
});
|
||||
});
|
||||
this.ptyProcessReady.then(async () => await this.getLatency());
|
||||
}
|
||||
|
||||
public dispose(immediate: boolean = false): void {
|
||||
@@ -240,6 +249,18 @@ export class TerminalProcessManager implements ITerminalProcessManager {
|
||||
return this._process.getCwd();
|
||||
}
|
||||
|
||||
public async getLatency(): Promise<number> {
|
||||
if (!this._process) {
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
if (this._latencyLastMeasured === 0 || this._latencyLastMeasured + LATENCY_MEASURING_INTERVAL < Date.now()) {
|
||||
this._latencyRequest = this._process.getLatency();
|
||||
this._latency = await this._latencyRequest;
|
||||
this._latencyLastMeasured = Date.now();
|
||||
}
|
||||
return Promise.resolve(this._latency);
|
||||
}
|
||||
|
||||
private _onExit(exitCode: number): void {
|
||||
this._process = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user