(params: RuntimeStopParams, context: RuntimeHandlerContext)
| 521 | } |
| 522 | |
| 523 | private async stopRuntime(params: RuntimeStopParams, context: RuntimeHandlerContext): Promise<RuntimeRecord | null> { |
| 524 | const current = this.supervisor.get(params.runtimeId) |
| 525 | if (!current) return null |
| 526 | |
| 527 | for (const handler of this.runtimeStopHandlers) { |
| 528 | if (await handler(current, params, context)) break |
| 529 | } |
| 530 | |
| 531 | const afterHandler = this.supervisor.get(params.runtimeId) |
| 532 | if (isTerminalRuntimeStatus(afterHandler?.status)) { |
| 533 | if (afterHandler?.status === "stopped" || !isActiveRuntimeStatus(current.status)) return afterHandler ?? null |
| 534 | } |
| 535 | |
| 536 | const stopped = this.supervisor.stop(params.runtimeId, params.reason) ?? null |
| 537 | if (stopped) this.notify("runtime/stopped", stopped) |
| 538 | return stopped |
| 539 | } |
| 540 | } |
no test coverage detected