MCPcopy Create free account
hub / github.com/inkeep/open-knowledge / waitFor

Function waitFor

packages/cli/tests/e2e/cli-linux-e2e.ts:57–67  ·  view source on GitHub ↗
(
  predicate: () => boolean | Promise<boolean>,
  { timeoutMs = 30_000, intervalMs = 250 } = {},
)

Source from the content-addressed store, hash-verified

55}
56
57async function waitFor(
58 predicate: () => boolean | Promise<boolean>,
59 { timeoutMs = 30_000, intervalMs = 250 } = {},
60): Promise<boolean> {
61 const deadline = Date.now() + timeoutMs;
62 while (Date.now() < deadline) {
63 if (await predicate()) return true;
64 await new Promise((r) => setTimeout(r, intervalMs));
65 }
66 return false;
67}
68
69function tcpConnect(host: string, port: number, timeoutMs: number): Promise<boolean> {
70 return new Promise((res) => {

Callers 1

cli-linux-e2e.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected