MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / waitForCondition

Function waitForCondition

test/core/bridge_coordinator.test.ts:1021–1031  ·  view source on GitHub ↗
(predicate, { timeoutMs = 1000, intervalMs = 10 } = {})

Source from the content-addressed store, hash-verified

1019}
1020
1021async function waitForCondition(predicate, { timeoutMs = 1000, intervalMs = 10 } = {}) {
1022 const deadline = Date.now() + timeoutMs;
1023 while (Date.now() < deadline) {
1024 const value = predicate();
1025 if (value) {
1026 return value;
1027 }
1028 await new Promise((resolve) => setTimeout(resolve, intervalMs));
1029 }
1030 throw new Error('Timed out waiting for condition');
1031}
1032
1033async function fullyConfirmLatestAgentJob(runtime, externalScopeId: string) {
1034 const created = await runtime.services.bridgeCoordinator.handleInboundEvent({

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected