fix(stats): harden server lifecycle and verify compiled runtime (#261)

This commit is contained in:
sudacode authored and GitHub committed 2026-09-20 23:19:03 -07:00
1 parent f9c4e892dc
commit 383aed8bad
37 files changed
+1381 -323

No files matched your search

+10 -3
View File
@@ -107,7 +107,7 @@ export interface CliCommandServiceDeps {
mode: NonNullable<CliArgs['youtubeMode']>;
source: CliCommandSource;
}) => Promise<void>;
ensureBackgroundStatsServer?: () => void;
ensureBackgroundStatsServer?: () => Promise<void> | void;
printHelp: () => void;
hasMainWindow: () => boolean;
getMultiCopyTimeoutMs: () => number;
@@ -188,7 +188,7 @@ interface AnilistCliRuntime {
interface AppCliRuntime {
stop: () => void;
hasMainWindow: () => boolean;
ensureBackgroundStatsServer?: () => void;
ensureBackgroundStatsServer?: () => Promise<void> | void;
runUpdateCommand: CliCommandServiceDeps['runUpdateCommand'];
runEnsureLinuxRuntimePluginAssetsCommand: CliCommandServiceDeps['runEnsureLinuxRuntimePluginAssetsCommand'];
runYoutubePlaybackFlow: CliCommandServiceDeps['runYoutubePlaybackFlow'];
@@ -400,7 +400,14 @@ export function handleCliCommand(
}
if (args.start && args.background) {
deps.ensureBackgroundStatsServer?.();
runAsyncWithOsd(
async () => {
await deps.ensureBackgroundStatsServer?.();
},
deps,
'ensureBackgroundStatsServer',
'Stats server startup failed',
);
}
if (args.sessionAction) {