Drain timed out remote daemon semaphores

This commit is contained in:
Lawrence Chen 2026-03-12 06:08:27 -07:00
parent d7d80ff5af
commit 8985f865e2

View file

@ -718,6 +718,9 @@ final class WorkspaceRemoteDaemonPendingCallRegistry {
queue.sync {
pendingCalls.removeValue(forKey: call.id)
}
// A response can win the race immediately before timeout cleanup removes the call.
// Drain any late signal so DispatchSemaphore is not deallocated with a positive count.
_ = call.semaphore.wait(timeout: .now())
return .timedOut
}