refactor: rename sockPath to listen in pid lock, add startup timing instrumentation
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ console.log('=== CLI IPC Target Helpers ===\n')
|
||||
mkdirSync(paseoHome, { recursive: true })
|
||||
writeFileSync(
|
||||
path.join(paseoHome, 'paseo.pid'),
|
||||
JSON.stringify({ pid: process.pid, sockPath: '/tmp/paseo-from-pid.sock' })
|
||||
JSON.stringify({ pid: process.pid, listen: '/tmp/paseo-from-pid.sock' })
|
||||
)
|
||||
assert.deepStrictEqual(resolveDefaultDaemonHosts({ PASEO_HOME: paseoHome }), [
|
||||
'unix:///tmp/paseo-from-pid.sock',
|
||||
@@ -93,7 +93,7 @@ console.log('=== CLI IPC Target Helpers ===\n')
|
||||
mkdirSync(paseoHome, { recursive: true })
|
||||
writeFileSync(
|
||||
path.join(paseoHome, 'paseo.pid'),
|
||||
JSON.stringify({ pid: process.pid, sockPath: '/tmp/paseo-priority.sock' })
|
||||
JSON.stringify({ pid: process.pid, listen: '/tmp/paseo-priority.sock' })
|
||||
)
|
||||
assert.deepStrictEqual(
|
||||
resolveDefaultDaemonHosts({
|
||||
|
||||
Reference in New Issue
Block a user