Fix orchestrator process hang after cleanup
The orchestrator process was hanging after completing its work because:
1. Fire-and-forget Redis operations in MessageBus.handleMessage() left
unhandled promises that kept the event loop alive
2. No explicit process.exit() call after cleanup
Changes:
- coordination.ts: Add .catch(() => {}) to fire-and-forget Redis ops
- orchestrator.ts: Add explicit process.exit(exitCode) after cleanup
- orchestrator.ts: Improve error handling in main() with proper exit codes
Tested: Pipeline mksup1wq completed full flow and exited cleanly.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
92d3602852
commit
ccc3b01609
@@ -389,6 +389,7 @@ The solution should consider fault tolerance, data consistency, and cost optimiz
|
||||
|
||||
const orchestrator = new MultiAgentOrchestrator(model);
|
||||
|
||||
let exitCode = 0;
|
||||
try {
|
||||
await orchestrator.initialize();
|
||||
const metrics = await orchestrator.runTask(task);
|
||||
@@ -402,9 +403,15 @@ The solution should consider fault tolerance, data consistency, and cost optimiz
|
||||
|
||||
} catch (e: any) {
|
||||
console.error("Orchestrator error:", e.message);
|
||||
exitCode = 1;
|
||||
} finally {
|
||||
await orchestrator.cleanup();
|
||||
// Explicitly exit to ensure all connections are closed
|
||||
process.exit(exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
main().catch((e) => {
|
||||
console.error("Fatal error:", e);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user