MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / waitForFirstResponse

Method waitForFirstResponse

e2e/cloud/mcp-sse-replay.test.ts:121–138  ·  view source on GitHub ↗
(timeoutMs: number)

Source from the content-addressed store, hash-verified

119 }
120
121 waitForFirstResponse(timeoutMs: number): Promise<JsonRpcMessage> {
122 const existing = this.messages.find(
123 (message) => typeof message.id === "string" || typeof message.id === "number",
124 );
125 if (existing) return Promise.resolve(existing);
126 return new Promise((resolve, reject) => {
127 const timeout = setTimeout(() => {
128 // oxlint-disable-next-line executor/no-promise-reject, executor/no-error-constructor -- boundary: Promise timeout adapter for e2e polling.
129 reject(new Error("timed out waiting for the first JSON-RPC response"));
130 }, timeoutMs);
131 this.responseWaiters.push({
132 resolve: (message) => {
133 clearTimeout(timeout);
134 resolve(message);
135 },
136 });
137 });
138 }
139
140 abort(reason: string): void {
141 this.abortController?.abort(reason);

Callers 1

Calls 4

rejectFunction · 0.85
resolveMethod · 0.80
pushMethod · 0.80
resolveFunction · 0.50

Tested by

no test coverage detected