Skip to content

Commit 9fdc988

Browse files
authored
Merge pull request microsoft#185258 from microsoft/tyriar/130320
Wait 20 seconds for first pty host heartbeat
2 parents 0987474 + 75a2ca8 commit 9fdc988

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/vs/platform/terminal/common/terminal.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,12 @@ export enum HeartbeatConstants {
392392
* The duration between heartbeats
393393
*/
394394
BeatInterval = 5000,
395+
/**
396+
* The duration of the first heartbeat while the pty host is starting up. This is much larger
397+
* than the regular BeatInterval to accomodate slow machines, we still want to warn about the
398+
* pty host's unresponsiveness eventually though.
399+
*/
400+
ConnectingBeatInterval = 20000,
395401
/**
396402
* Defines a multiplier for BeatInterval for how long to wait before starting the second wait
397403
* timer.

src/vs/platform/terminal/node/ptyHostService.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ export class PtyHostService extends Disposable implements IPtyService {
149149
// Setup heartbeat service and trigger a heartbeat immediately to reset the timeouts
150150
const heartbeatService = ProxyChannel.toService<IHeartbeatService>(client.getChannel(TerminalIpcChannels.Heartbeat));
151151
heartbeatService.onBeat(() => this._handleHeartbeat());
152-
// TODO: Starting the heartbeat tracking now causes problems
153-
this._handleHeartbeat();
152+
this._handleHeartbeat(true);
154153

155154
// Handle exit
156155
this._register(connection.onDidProcessExit(e => {
@@ -351,9 +350,9 @@ export class PtyHostService extends Disposable implements IPtyService {
351350
this._connection.store.dispose();
352351
}
353352

354-
private _handleHeartbeat() {
353+
private _handleHeartbeat(isConnecting?: boolean) {
355354
this._clearHeartbeatTimeouts();
356-
this._heartbeatFirstTimeout = setTimeout(() => this._handleHeartbeatFirstTimeout(), HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier);
355+
this._heartbeatFirstTimeout = setTimeout(() => this._handleHeartbeatFirstTimeout(), isConnecting ? HeartbeatConstants.ConnectingBeatInterval : (HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier));
357356
if (!this._isResponsive) {
358357
this._isResponsive = true;
359358
this._onPtyHostResponsive.fire();

0 commit comments

Comments
 (0)