Skip to content

Commit 4fbb8a9

Browse files
author
root
committed
refactor(server): re-read session state after terminal close
1 parent 316a65f commit 4fbb8a9

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/server/src/session/manager.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,15 @@ export class SessionManager {
157157

158158
await this.deps.terminalMgr.close(session.terminalId);
159159

160-
if (this.sessions.has(session.id) && session.state !== "ended") {
161-
this.finishSession(session, this.terminalToSession.has(session.terminalId) ? undefined : 0);
160+
const latestSession = this.sessions.get(session.id);
161+
if (!latestSession || latestSession.state === "ended") {
162+
return;
162163
}
164+
165+
this.finishSession(
166+
latestSession,
167+
this.terminalToSession.has(latestSession.terminalId) ? undefined : 0
168+
);
163169
}
164170

165171
async hydrate(): Promise<void> {

0 commit comments

Comments
 (0)