fix: restore stats daemon deferral

This commit is contained in:
2026-05-03 18:40:18 -07:00
parent 805b68dd92
commit a2fd3cd194
4 changed files with 77 additions and 4 deletions
+3 -1
View File
@@ -14,7 +14,7 @@ function formatStatsServerUrl(port: number): string {
return `http://127.0.0.1:${port}`;
}
export type EnsureStatsServerUrlResult = { url: string; source: 'local' };
export type EnsureStatsServerUrlResult = { url: string; source: 'background' | 'local' };
export function createEnsureStatsServerUrlHandler(
deps: EnsureStatsServerUrlDeps,
@@ -27,6 +27,8 @@ export function createEnsureStatsServerUrlHandler(
deps.removeBackgroundState();
} else if (!deps.isProcessAlive(state.pid)) {
deps.removeBackgroundState();
} else if (state.pid !== deps.currentPid) {
return { url: formatStatsServerUrl(state.port), source: 'background' };
}
if (!deps.hasLocalStatsServer()) {