Skip to content

Commit e48c9bf

Browse files
committed
fix: move restartAttempt reset from onStarted to onReady
A crash-looping process that spawns successfully but exits immediately would reset restartAttempt to 0 in onStarted before scheduleRestart runs, defeating the exponential backoff. Moving the reset to onReady ensures the backoff counter only resets once the backend is confirmed healthy via the HTTP readiness check.
1 parent c9345f4 commit e48c9bf

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

apps/desktop/src/backend/DesktopBackendManager.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,16 +422,13 @@ const makeDesktopBackendManager = Effect.fn("makeDesktopBackendManager")(functio
422422
...run,
423423
pid: Option.some(pid),
424424
}));
425-
yield* Ref.update(state, (latest) => ({
426-
...latest,
427-
restartAttempt: 0,
428-
}));
429425
yield* events.onStarted({ pid, config });
430426
}),
431427
onReady: () =>
432428
Effect.gen(function* () {
433429
yield* Ref.update(state, (latest) => ({
434430
...latest,
431+
restartAttempt: 0,
435432
ready: Option.match(latest.active, {
436433
onNone: () => latest.ready,
437434
onSome: (run) => (run.id === runId ? true : latest.ready),

0 commit comments

Comments
 (0)