Skip to content

Commit 9aaba83

Browse files
committed
remove terminal reconnect hack (we will fix it properly somehow if still an issue)
1 parent 0f2e3f6 commit 9aaba83

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/packages/frontend/frame-editors/terminal-editor/connected-terminal.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ declare const $: any;
4646
const SCROLLBACK = 5000;
4747
const MAX_HISTORY_LENGTH = 100 * SCROLLBACK;
4848

49-
const MAX_DELAY = 15000;
49+
// const MAX_DELAY = 15000;
5050

5151
const ENABLE_WEBGL = false;
5252

@@ -77,9 +77,9 @@ export class Terminal<T extends CodeEditorState = CodeEditorState> {
7777
private pauseKeyCount: number = 0;
7878
private keyhandler_initialized: boolean = false;
7979
// last time user typed something
80-
private lastSend = 0;
80+
// private lastSend = 0;
8181
// last time we received data back from project
82-
private lastReceive = 0;
82+
// private lastReceive = 0;
8383
/* We initially have to ignore when rendering the initial history.
8484
To TEST this, do this in a terminal, then reconnect:
8585
printf "\E[c\n" ; sleep 1 ; echo
@@ -187,7 +187,7 @@ export class Terminal<T extends CodeEditorState = CodeEditorState> {
187187
this.init_settings();
188188
this.init_touch();
189189
this.set_connection_status("disconnected");
190-
this.reconnectIfNotResponding();
190+
// this.reconnectIfNotResponding();
191191

192192
// The docs https://xtermjs.org/docs/api/terminal/classes/terminal/#resize say
193193
// "It’s best practice to debounce calls to resize, this will help ensure that
@@ -320,10 +320,10 @@ export class Terminal<T extends CodeEditorState = CodeEditorState> {
320320
ephemeral: EPHEMERAL,
321321
});
322322
this.conn = conn as any;
323-
conn.on("close", this.connect);
323+
conn.once("close", this.connect);
324324
conn.on("kick", this.close_request);
325325
conn.on("data", this.handleDataFromProject);
326-
conn.on("init", (data) => {
326+
conn.once("init", (data) => {
327327
this.terminal.clear();
328328
this.render(data);
329329
});
@@ -371,19 +371,19 @@ export class Terminal<T extends CodeEditorState = CodeEditorState> {
371371
return;
372372
}
373373
this.conn.write(data);
374-
this.lastSend = Date.now();
374+
//this.lastSend = Date.now();
375375
};
376376

377377
// this should never ever be necessary. It's a just-in-case things
378378
// were myseriously totally broken measure...
379-
private reconnectIfNotResponding = async () => {
380-
while (this.state != "closed") {
381-
if (this.lastSend - this.lastReceive >= MAX_DELAY) {
382-
await this.connect();
383-
}
384-
await delay(MAX_DELAY / 2);
385-
}
386-
};
379+
// private reconnectIfNotResponding = async () => {
380+
// while (this.state != "closed") {
381+
// if (this.lastSend - this.lastReceive >= MAX_DELAY) {
382+
// await this.connect();
383+
// }
384+
// await delay(MAX_DELAY / 2);
385+
// }
386+
// };
387387

388388
private handleDataFromProject = (data: any): void => {
389389
this.assert_not_closed();
@@ -399,7 +399,7 @@ export class Terminal<T extends CodeEditorState = CodeEditorState> {
399399
};
400400

401401
private activity = () => {
402-
this.lastReceive = Date.now();
402+
//this.lastReceive = Date.now();
403403
this.project_actions.flag_file_activity(this.path);
404404
};
405405

0 commit comments

Comments
 (0)