refactor: keep transport readiness independent of global logging (#147676)

This commit is contained in:
Peter Steinberger 2026-09-13 22:26:53 -07:00 • committed by GitHub
parent da39dbae88
commit bcb8fa7b2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,6 @@
// Polls channel transports until they are ready for runtime work.
import { resolveTimerTimeoutMs } from "@openclaw/normalization-core/number-coercion";
import { danger } from "../globals.js";
import { theme } from "../../packages/terminal-core/src/theme.js";
import type { RuntimeEnv } from "../runtime.js";
import { sleepWithAbort } from "./backoff.js";
@ -55,7 +55,9 @@ export async function waitForTransportReady(params: WaitForTransportReadyParams)
if (now >= nextLogAt) {
const elapsedMs = now - started;
params.runtime.error?.(
danger(`${params.label} not ready after ${elapsedMs}ms (${lastError ?? "unknown error"})`),
theme.error(
`${params.label} not ready after ${elapsedMs}ms (${lastError ?? "unknown error"})`,
),
);
nextLogAt = now + logIntervalMs;
}
@ -73,7 +75,7 @@ export async function waitForTransportReady(params: WaitForTransportReadyParams)
}
params.runtime.error?.(
danger(`${params.label} not ready after ${timeoutMs}ms (${lastError ?? "unknown error"})`),
theme.error(`${params.label} not ready after ${timeoutMs}ms (${lastError ?? "unknown error"})`),
);
throw new Error(`${params.label} not ready (${lastError ?? "unknown error"})`);
}