fix(terminal): remove upgrade listener on shutdown (#1233)

Co-authored-by: Isaac Sanchez <isanchez-hawkins@arize.com>
This commit is contained in:
Isaac Sanchez-Hawkins
2026-05-12 11:01:31 +03:00
committed by GitHub
co-authored by Isaac Sanchez
parent 109aecf3de
commit 060a5311ef
2 changed files with 50 additions and 2 deletions
+6 -2
View File
@@ -385,7 +385,7 @@ export function createTerminalRuntime({
});
});
server.on('upgrade', (req, socket, head) => {
const upgradeHandler = (req, socket, head) => {
const pathname = parseRequestPathname(req.url);
if (pathname !== TERMINAL_INPUT_WS_PATH) {
return;
@@ -422,7 +422,9 @@ export function createTerminalRuntime({
};
void handleUpgrade();
});
};
server.on('upgrade', upgradeHandler);
const wireTerminalSession = (sessionId, session) => {
session.ptyProcess.onData((data) => {
@@ -791,6 +793,8 @@ export function createTerminalRuntime({
});
const shutdown = async () => {
server.off('upgrade', upgradeHandler);
if (idleSweepInterval) {
clearInterval(idleSweepInterval);
}