perf(dashboard): start project engines in background
Awaiting engineManager.startAll() during dashboard startup blocked the TUI on the slowest project's git/state init. Engine startup now runs fire-and-forget; the reconciliation loop and the server's on-access fast path cover any engine the user reaches before it's up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
5
.changeset/dashboard-startup-engines-background.md
Normal file
5
.changeset/dashboard-startup-engines-background.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@runfusion/fusion": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix slow `fusion` startup that hung on "Starting engine…" while every registered project's engine initialized serially in `Promise.allSettled`. Engine startup now runs in the background — the TUI proceeds immediately, and the existing reconciliation loop plus the server's on-access fast path bring each project's engine up before it's actually needed.
|
||||||
@@ -1515,8 +1515,14 @@ export async function runDashboard(port: number, opts: { paused?: boolean; dev?:
|
|||||||
getTaskMergeBlocker,
|
getTaskMergeBlocker,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Start engines for all registered projects eagerly
|
// Start engines for all registered projects in the background. The
|
||||||
await engineManager.startAll();
|
// on-access fast path (server's onProjectFirstAccessed) and the
|
||||||
|
// reconciliation loop below both cover correctness, so awaiting here
|
||||||
|
// just blocks the TUI on the slowest project's git/state init.
|
||||||
|
void engineManager.startAll().catch((err) => {
|
||||||
|
const message = err instanceof Error ? err.message : String(err);
|
||||||
|
logSink.warn(`Background engine startup failed: ${message}`, "dashboard");
|
||||||
|
});
|
||||||
|
|
||||||
let hybridExecutor: HybridExecutor | undefined = undefined;
|
let hybridExecutor: HybridExecutor | undefined = undefined;
|
||||||
const hybridGate = await shouldUseHybridExecutor(centralCoreForEngine);
|
const hybridGate = await shouldUseHybridExecutor(centralCoreForEngine);
|
||||||
|
|||||||
Reference in New Issue
Block a user