mirror of
https://github.com/louislam/dockge.git
synced 2026-05-21 14:02:17 +00:00
Close terminal if there is no clients (#60)
* Close terminal if there is no clients connecting * Only enable * Join the terminal only if it is managed by Dockge * Done
This commit is contained in:
@@ -30,6 +30,7 @@ import { Cron } from "croner";
|
||||
import gracefulShutdown from "http-graceful-shutdown";
|
||||
import User from "./models/user";
|
||||
import childProcess from "child_process";
|
||||
import { Terminal } from "./terminal";
|
||||
|
||||
export class DockgeServer {
|
||||
app : Express;
|
||||
@@ -230,6 +231,11 @@ export class DockgeServer {
|
||||
|
||||
});
|
||||
|
||||
if (isDev) {
|
||||
setInterval(() => {
|
||||
log.debug("terminal", "Terminal count: " + Terminal.getTerminalCount());
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
async afterLogin(socket : DockgeSocket, user : User) {
|
||||
@@ -292,11 +298,11 @@ export class DockgeServer {
|
||||
log.info("server", `Listening on ${this.config.port}`);
|
||||
}
|
||||
|
||||
// Run every 5 seconds
|
||||
Cron("*/2 * * * * *", {
|
||||
// Run every 10 seconds
|
||||
Cron("*/10 * * * * *", {
|
||||
protect: true, // Enabled over-run protection.
|
||||
}, () => {
|
||||
log.debug("server", "Cron job running");
|
||||
//log.debug("server", "Cron job running");
|
||||
this.sendStackList(true);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user