docs: document gateway runtime startup · openclaw/openclaw@dc23e92
steipete
·
2026-06-05
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Gateway plugin bootstrap helpers. |
| 2 | +// Applies activation config, installs runtime bindings, loads and pins plugins. |
1 | 3 | import { primeConfiguredBindingRegistry } from "../channels/plugins/binding-registry.js"; |
2 | 4 | import { applyPluginAutoEnable } from "../config/plugin-auto-enable.js"; |
3 | 5 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Gateway startup runtime-config resolver. |
| 2 | +// Normalizes bind/auth/HTTP/Tailscale/hook settings before server construction. |
1 | 3 | import type { |
2 | 4 | GatewayAuthConfig, |
3 | 5 | GatewayBindMode, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Gateway mutable runtime handles. |
| 2 | +// Provides stop-safe defaults for timers, sidecars, subscriptions, and services. |
1 | 3 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
2 | 4 | import type { HeartbeatRunner } from "../infra/heartbeat-runner.js"; |
3 | 5 | import type { ChannelHealthMonitor } from "./channel-health-monitor.js"; |
@@ -37,6 +39,8 @@ export type GatewayServerMutableState = {
|
37 | 39 | /** Creates gateway mutable state with inert handles that are safe to stop before startup finishes. */ |
38 | 40 | export function createGatewayServerMutableState(): GatewayServerMutableState { |
39 | 41 | const noopInterval = () => { |
| 42 | +// Dummy unref'd timers give shutdown code a concrete handle to clear even |
| 43 | +// when startup exits before real maintenance intervals are installed. |
40 | 44 | const timer = setInterval(() => {}, 1 << 30); |
41 | 45 | timer.unref?.(); |
42 | 46 | return timer; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Gateway post-ready runtime services. |
| 2 | +// Starts delayed maintenance, cron, heartbeat, recovery, and pricing refresh work. |
1 | 3 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
2 | 4 | import { isVitestRuntimeEnv } from "../infra/env.js"; |
3 | 5 | import { startHeartbeatRunner, type HeartbeatRunner } from "../infra/heartbeat-runner.js"; |
@@ -35,6 +37,8 @@ function clearGatewayMaintenanceHandles(maintenance: GatewayMaintenanceHandles |
|
35 | 37 | if (!maintenance) { |
36 | 38 | return; |
37 | 39 | } |
| 40 | +// Maintenance startup can race shutdown. Clear every interval handle here so |
| 41 | +// callers can discard partially-created maintenance safely. |
38 | 42 | clearInterval(maintenance.tickInterval); |
39 | 43 | clearInterval(maintenance.healthInterval); |
40 | 44 | clearInterval(maintenance.dedupeCleanup); |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Gateway startup-time runtime services. |
| 2 | +// Starts mode-dependent background monitors with inert handles for disabled paths. |
1 | 3 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
2 | 4 | import type { ChannelHealthMonitor } from "./channel-health-monitor.js"; |
3 | 5 | import { startChannelHealthMonitor } from "./channel-health-monitor.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Gateway HTTP/WebSocket runtime state factory. |
| 2 | +// Builds one server runtime with pinned plugin registries and lazy route handlers. |
1 | 3 | import type { IncomingMessage, Server as HttpServer, ServerResponse } from "node:http"; |
2 | 4 | import type { Duplex } from "node:stream"; |
3 | 5 | import { WebSocketServer } from "ws"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Gateway early-startup runtime helpers. |
| 2 | +// Starts discovery, remote skills, task maintenance, and delayed maintenance setup. |
1 | 3 | import type { GatewayTailscaleMode } from "../config/types.gateway.js"; |
2 | 4 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
3 | 5 | import { resolveCronJobsStorePath } from "../cron/store.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Gateway post-attach startup sidecars. |
| 2 | +// Schedules warmups, sentinels, update checks, memory backend, and plugin services. |
1 | 3 | import fs from "node:fs"; |
2 | 4 | import os from "node:os"; |
3 | 5 | import path from "node:path"; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。