-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Context
DaemonLifecycle.swift — DaemonLauncher.killExistingDaemon() (lines 78-105) uses Thread.sleep(forTimeInterval: 0.1) in a polling loop (up to 20 iterations = 2 seconds) to wait for a daemon process to die after SIGTERM.
Problem
Thread.sleep blocks the actor's executor thread, preventing any other work from running on the DaemonLauncher actor during that time. Since killExistingDaemon is called from async methods (ensureDaemon, restartDaemon), it should use cooperative async sleeping.
Proposal
Make killExistingDaemon() async and replace Thread.sleep with try await Task.sleep:
private func killExistingDaemon() async {
// ...
kill(pid, SIGTERM)
for _ in 0..<20 {
try? await Task.sleep(nanoseconds: 100_000_000)
if kill(pid, 0) != 0 { break }
}
// ...
}🤖 Generated with Claude Code
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request