refactor: rename sockPath to listen in pid lock, add startup timing instrumentation

This commit is contained in:
Mohamed Boudra
2026-03-12 14:19:21 +07:00
parent 213f155c9c
commit 9f089be946
10 changed files with 124 additions and 63 deletions
@@ -20,7 +20,7 @@ export interface LocalDaemonPidInfo {
startedAt?: string
hostname?: string
uid?: number
sockPath?: string
listen?: string
}
export interface LocalDaemonState {
@@ -164,7 +164,7 @@ function readPidFile(pidPath: string): LocalDaemonPidInfo | null {
startedAt: typeof parsed.startedAt === 'string' ? parsed.startedAt : undefined,
hostname: typeof parsed.hostname === 'string' ? parsed.hostname : undefined,
uid: typeof parsed.uid === 'number' ? parsed.uid : undefined,
sockPath: typeof parsed.sockPath === 'string' ? parsed.sockPath : undefined,
listen: typeof parsed.listen === 'string' ? parsed.listen : typeof parsed.sockPath === 'string' ? parsed.sockPath : undefined,
}
} catch {
return null
@@ -322,7 +322,7 @@ export function resolveLocalDaemonState(options: { home?: string } = {}): LocalD
const logPath = path.join(home, DAEMON_LOG_FILENAME)
const pidInfo = existsSync(pidPath) ? readPidFile(pidPath) : null
const running = pidInfo ? isProcessRunning(pidInfo.pid) : false
const listen = pidInfo?.sockPath ?? config.listen
const listen = pidInfo?.listen ?? config.listen
return {
home,
+2 -2
View File
@@ -75,8 +75,8 @@ function readPidSocketTarget(paseoHome: string): string | null {
}
try {
const parsed = JSON.parse(readFileSync(pidPath, 'utf-8')) as { sockPath?: unknown }
return typeof parsed.sockPath === 'string' ? parsed.sockPath : null
const parsed = JSON.parse(readFileSync(pidPath, 'utf-8')) as { listen?: unknown; sockPath?: unknown }
return typeof parsed.listen === 'string' ? parsed.listen : typeof parsed.sockPath === 'string' ? parsed.sockPath : null
} catch {
return null
}