mirror of
https://github.com/louislam/dockge.git
synced 2025-02-25 21:15:56 +00:00
Only enable
This commit is contained in:
parent
fe6735824c
commit
04140c4edd
1 changed files with 17 additions and 11 deletions
|
@ -34,6 +34,7 @@ export class Terminal {
|
||||||
protected _rows : number = TERMINAL_ROWS;
|
protected _rows : number = TERMINAL_ROWS;
|
||||||
protected _cols : number = TERMINAL_COLS;
|
protected _cols : number = TERMINAL_COLS;
|
||||||
|
|
||||||
|
public enableKeepAlive : boolean = false;
|
||||||
protected keepAliveInterval? : NodeJS.Timeout;
|
protected keepAliveInterval? : NodeJS.Timeout;
|
||||||
|
|
||||||
constructor(server : DockgeServer, name : string, file : string, args : string | string[], cwd : string) {
|
constructor(server : DockgeServer, name : string, file : string, args : string | string[], cwd : string) {
|
||||||
|
@ -110,6 +111,9 @@ export class Terminal {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.enableKeepAlive) {
|
||||||
|
log.debug("Terminal", "Keep alive enabled for terminal " + this.name);
|
||||||
|
|
||||||
// Close if there is no clients
|
// Close if there is no clients
|
||||||
this.keepAliveInterval = setInterval(() => {
|
this.keepAliveInterval = setInterval(() => {
|
||||||
const clients = this.server.io.sockets.adapter.rooms.get(this.name);
|
const clients = this.server.io.sockets.adapter.rooms.get(this.name);
|
||||||
|
@ -122,7 +126,9 @@ export class Terminal {
|
||||||
log.debug("Terminal", "Terminal " + this.name + " has " + numClients + " client(s)");
|
log.debug("Terminal", "Terminal " + this.name + " has " + numClients + " client(s)");
|
||||||
}
|
}
|
||||||
}, 60 * 1000);
|
}, 60 * 1000);
|
||||||
|
} else {
|
||||||
|
log.debug("Terminal", "Keep alive disabled for terminal " + this.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public onExit(callback : (exitCode : number) => void) {
|
public onExit(callback : (exitCode : number) => void) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue