mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor(dokploy): revert
This commit is contained in:
@@ -5,11 +5,6 @@ import { Client } from "ssh2";
|
||||
import { WebSocketServer } from "ws";
|
||||
import { getShell } from "./utils";
|
||||
|
||||
function heartbeat() {
|
||||
// @ts-ignore
|
||||
this.isAlive = true;
|
||||
}
|
||||
|
||||
export const setupDockerContainerLogsWebSocketServer = (
|
||||
server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>,
|
||||
) => {
|
||||
@@ -48,11 +43,6 @@ export const setupDockerContainerLogsWebSocketServer = (
|
||||
ws.close();
|
||||
return;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
ws.isAlive = true;
|
||||
ws.on("error", console.error);
|
||||
ws.on("pong", heartbeat);
|
||||
try {
|
||||
if (serverId) {
|
||||
const server = await findServerById(serverId);
|
||||
@@ -148,18 +138,4 @@ export const setupDockerContainerLogsWebSocketServer = (
|
||||
ws.send(errorMessage);
|
||||
}
|
||||
});
|
||||
|
||||
const interval = setInterval(function ping() {
|
||||
for (const ws of wssTerm.clients) {
|
||||
// @ts-ignore
|
||||
if (ws.isAlive === false) return ws.terminate();
|
||||
// @ts-ignore
|
||||
ws.isAlive = false;
|
||||
ws.ping();
|
||||
}
|
||||
}, 30000);
|
||||
|
||||
wssTerm.on("close", function close() {
|
||||
clearInterval(interval);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user