fix(orchestrator): own startup and shutdown resources (CL16)

This commit is contained in:
Boki 2026-10-26 19:28:43 -04:00
parent 21666242f4
commit 8546fce4a9
8 changed files with 384 additions and 117 deletions

View file

@ -15,6 +15,7 @@ import { PaperDeploymentHost } from './paper/PaperDeploymentHost';
import { AnalyticsService } from './services/AnalyticsService';
import { StorageService } from './services/StorageService';
import { createBuiltinStrategy } from './strategies/canonical-builtins';
import { stopOrchestratorWork } from './runtime';
import type { OrchestratorServices as IServiceContainer } from './types';
export type OrchestratorRole = 'paper' | 'research-only';
@ -203,9 +204,9 @@ export async function registerOrchestratorServices(
}
services.queueManager?.getQueue('orchestrator', { workers: 1, concurrency: maxConcurrent });
} catch (error) {
await runner.shutdown().catch(() => {});
await paper?.shutdown().catch(() => {});
await deploymentHost?.shutdown().catch(() => {});
await stopOrchestratorWork(services).catch(cleanupError => {
services.logger.error('Orchestrator registration cleanup failed', { cleanupError });
});
throw error;
}
}