From 7fd8b0b8dee8922c75f3d35c7d732b88c634cbef Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sun, 31 May 2026 09:29:29 -0700 Subject: [PATCH] fix: unref mobile fit cleanup timers (#4245) --- src/main/runtime/orca-runtime.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/runtime/orca-runtime.ts b/src/main/runtime/orca-runtime.ts index c94a95d05..a087760a5 100644 --- a/src/main/runtime/orca-runtime.ts +++ b/src/main/runtime/orca-runtime.ts @@ -4382,6 +4382,9 @@ export class OrcaRuntimeService { this.setDriver(ptyId, { kind: 'idle' }) } }, SOFT_LEAVE_GRACE_MS) + if (typeof softTimer.unref === 'function') { + softTimer.unref() + } this.pendingSoftLeavers.set(ptyId, { clientId, timer: softTimer, @@ -4435,6 +4438,11 @@ export class OrcaRuntimeService { rows: restoreRows }) }, autoRestoreMs) + // Why: a delayed mobile restore should not keep Electron main alive + // after the last window/runtime transport has otherwise shut down. + if (typeof timer.unref === 'function') { + timer.unref() + } this.pendingRestoreTimers.set(ptyId, { timer, clientId }) }