mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-12 07:43:37 -04:00
fix(terminal): turn off the idle limit by default
A long command without output (for example pg_restore) was ended after 30 minutes. Sessions still end on lost access and at the maximum duration.
This commit is contained in:
@@ -519,7 +519,7 @@ function watchTerminalSession(userSession, ptyProcess, terminalSessionId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Date.now() - userSession.lastActivityAt >= TERMINAL_IDLE_TIMEOUT_SECONDS * 1000) {
|
||||
if (TERMINAL_IDLE_TIMEOUT_SECONDS > 0 && Date.now() - userSession.lastActivityAt >= TERMINAL_IDLE_TIMEOUT_SECONDS * 1000) {
|
||||
await endTerminalSession(userSession, ptyProcess, 'idle', `no input or output for ${TERMINAL_IDLE_TIMEOUT_SECONDS / 60} minutes.`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -167,12 +167,10 @@ test('input keeps a session without output alive', async () => {
|
||||
assert.deepEqual(session.ends, []);
|
||||
});
|
||||
|
||||
test('a session with no input and no output ends after the idle timeout', async () => {
|
||||
test('a session with no input and no output is not ended as idle by default', async () => {
|
||||
const session = await startWatchedSession();
|
||||
await session.at(10, session.output);
|
||||
await session.at(39, session.tick);
|
||||
assert.deepEqual(session.ends, []);
|
||||
await session.at(7 * 60, session.tick);
|
||||
|
||||
await session.at(40, session.tick);
|
||||
assert.deepEqual(session.ends, ['idle']);
|
||||
assert.deepEqual(session.ends, []);
|
||||
});
|
||||
|
||||
@@ -2,8 +2,11 @@ import { parseCookie } from 'cookie';
|
||||
|
||||
export const MAX_TERMINAL_SESSION_TIMEOUT_SECONDS = 8 * 60 * 60;
|
||||
|
||||
/** A PTY with no input and no output for this long is ended. */
|
||||
export const TERMINAL_IDLE_TIMEOUT_SECONDS = 30 * 60;
|
||||
/**
|
||||
* A PTY with no input and no output for this long is ended. 0 turns the idle limit off, so a
|
||||
* long command without output (for example a restore) keeps running until the maximum duration.
|
||||
*/
|
||||
export const TERMINAL_IDLE_TIMEOUT_SECONDS = 0;
|
||||
|
||||
/** How often each live PTY checks with Coolify that the user may still use it. */
|
||||
export const TERMINAL_SESSION_CHECK_INTERVAL_MS = 60 * 1000;
|
||||
|
||||
Reference in New Issue
Block a user