mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 03:20:43 +00:00
fix(gateway): wait for event loop before client start
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { getRuntimeConfig, type OpenClawConfig } from "../config/config.js";
|
||||
import { startGatewayClientWhenEventLoopReady } from "../gateway/client-start-readiness.js";
|
||||
import { GatewayClient, type GatewayReconnectPausedInfo } from "../gateway/client.js";
|
||||
import { resolveGatewayConnectionAuth } from "../gateway/connection-auth.js";
|
||||
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../gateway/protocol/client-info.js";
|
||||
@@ -269,6 +270,11 @@ export async function runNodeHost(opts: NodeHostRunOptions): Promise<void> {
|
||||
return bins;
|
||||
}, pathEnv);
|
||||
|
||||
client.start();
|
||||
const readiness = await startGatewayClientWhenEventLoopReady(client, {
|
||||
clientOptions: { preauthHandshakeTimeoutMs: cfg.gateway?.handshakeTimeoutMs },
|
||||
});
|
||||
if (!readiness.ready) {
|
||||
throw new Error("node host gateway event loop readiness timeout");
|
||||
}
|
||||
await new Promise(() => {});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user