diff --git a/src/vs/platform/terminal/common/terminal.ts b/src/vs/platform/terminal/common/terminal.ts index 3a449fbecf2..ba334c728b1 100644 --- a/src/vs/platform/terminal/common/terminal.ts +++ b/src/vs/platform/terminal/common/terminal.ts @@ -392,6 +392,12 @@ export enum HeartbeatConstants { * The duration between heartbeats */ BeatInterval = 5000, + /** + * The duration of the first heartbeat while the pty host is starting up. This is much larger + * than the regular BeatInterval to accomodate slow machines, we still want to warn about the + * pty host's unresponsiveness eventually though. + */ + ConnectingBeatInterval = 20000, /** * Defines a multiplier for BeatInterval for how long to wait before starting the second wait * timer. diff --git a/src/vs/platform/terminal/node/ptyHostService.ts b/src/vs/platform/terminal/node/ptyHostService.ts index eb27e7d58f9..3679445c140 100644 --- a/src/vs/platform/terminal/node/ptyHostService.ts +++ b/src/vs/platform/terminal/node/ptyHostService.ts @@ -149,8 +149,7 @@ export class PtyHostService extends Disposable implements IPtyService { // Setup heartbeat service and trigger a heartbeat immediately to reset the timeouts const heartbeatService = ProxyChannel.toService(client.getChannel(TerminalIpcChannels.Heartbeat)); heartbeatService.onBeat(() => this._handleHeartbeat()); - // TODO: Starting the heartbeat tracking now causes problems - this._handleHeartbeat(); + this._handleHeartbeat(true); // Handle exit this._register(connection.onDidProcessExit(e => { @@ -351,9 +350,9 @@ export class PtyHostService extends Disposable implements IPtyService { this._connection.store.dispose(); } - private _handleHeartbeat() { + private _handleHeartbeat(isConnecting?: boolean) { this._clearHeartbeatTimeouts(); - this._heartbeatFirstTimeout = setTimeout(() => this._handleHeartbeatFirstTimeout(), HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier); + this._heartbeatFirstTimeout = setTimeout(() => this._handleHeartbeatFirstTimeout(), isConnecting ? HeartbeatConstants.ConnectingBeatInterval : (HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier)); if (!this._isResponsive) { this._isResponsive = true; this._onPtyHostResponsive.fire();