mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 08:24:45 +00:00
test: clear node invoke connect timeout
This commit is contained in:
@@ -275,12 +275,22 @@ describe("node.invoke approval bypass", () => {
|
||||
},
|
||||
});
|
||||
client.start();
|
||||
await Promise.race([
|
||||
ready,
|
||||
sleep(NODE_CONNECT_TIMEOUT_MS).then(() => {
|
||||
throw new Error("timeout waiting for node to connect");
|
||||
}),
|
||||
]);
|
||||
let timer: NodeJS.Timeout | undefined;
|
||||
try {
|
||||
await Promise.race([
|
||||
ready,
|
||||
new Promise<never>((_, reject) => {
|
||||
timer = setTimeout(
|
||||
() => reject(new Error("timeout waiting for node to connect")),
|
||||
NODE_CONNECT_TIMEOUT_MS,
|
||||
);
|
||||
}),
|
||||
]);
|
||||
} finally {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
return client;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user