Skip to content

Commit a5cf7cc

Browse files
fix: optimize engine startup logic to avoid unnecessary waiting when no PID is recorded
1 parent 65b9d06 commit a5cf7cc

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

dashboard/lib/services/engine_bundled_launcher.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,14 @@ class EngineBundledLauncher {
106106
}
107107

108108
if (!forceRestart) {
109-
final diskRunning =
110-
await _waitRunningOnDiskWithin(cfg.host, _healthWindow);
109+
// If the dashboard previously wrote "starting" but no PID was ever recorded
110+
// (e.g. first install, app closed quickly, or reboot), waiting a full health
111+
// window just delays startup and can look like a hang.
112+
final shouldWaitForExisting =
113+
cfg.pid != 0 && cfg.status != EngineStatus.stopped;
114+
final diskRunning = shouldWaitForExisting
115+
? await _waitRunningOnDiskWithin(cfg.host, _healthWindow)
116+
: null;
111117
if (diskRunning != null) {
112118
_engineStartedByApp =
113119
_ownedProcess != null && diskRunning.pid == _ownedProcess!.pid;

0 commit comments

Comments
 (0)