Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/runtime/graph/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,16 @@ async function runGraphLoop(
})
}
rearmWakeSignal()
// An abort must reach a PARKED run too: nothing is live, no wake is coming, and the host is
// shutting the run down — the wait ends now and the loop exits on the aborted signal.
const abortWake = new Promise<void>((fire) => {
if (abort.signal.aborted) fire()
else abort.signal.addEventListener('abort', () => fire(), { once: true })
})

let pendingNext: Promise<Settled<unknown> | null> | undefined
while (!failure) {
if (abort.signal.aborted) break
if (await expireDue()) continue
if (wakes.length > 0) {
await drainWakes()
Expand All @@ -768,7 +775,7 @@ async function runGraphLoop(
if (parked.length === 0) break // stuck or complete: `assembleGraphResult` classifies it
if (options.waitForWakes) {
rearmWakeSignal()
await wakeSignal
await Promise.race([wakeSignal, abortWake])
continue
}
// Offline (#976): no host will answer, so a `default` suspension resolves now; `wait` and a
Expand Down
9 changes: 8 additions & 1 deletion src/runtime/supervise/supervisor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,14 @@ export function uncertainSpawnBudgets(events: SpawnEvent[]): Budget[] {
return events
.filter(
(event): event is SpawnedEvent =>
event.kind === 'spawned' && event.parent !== undefined && !terminal.has(event.id),
event.kind === 'spawned' &&
event.parent !== undefined &&
!terminal.has(event.id) &&
// An `inline` executor runs inside the process that spawned it, so a resume can prove it
// dead rather than in-doubt: holding its reservation would charge the pool for work no
// process can ever finish. Only a runtime that can re-attach across a process boundary
// (bridge, sandbox) keeps its reservation charged as uncertain.
event.runtime !== 'inline',
)
.map((event) => event.budget)
}
Expand Down
Loading