MCPcopy Create free account
hub / github.com/altic-dev/Pilot / pollForExecutionId

Function pollForExecutionId

src/components/tool-invocation.tsx:368–395  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

366
367 // Poll for execution ID
368 const pollForExecutionId = async (): Promise<string | null> => {
369 const maxAttempts = 10;
370 let attempts = 0;
371
372 while (attempts < maxAttempts) {
373 try {
374 const response = await fetch("/api/experiment-progress", {
375 method: "POST",
376 headers: { "Content-Type": "application/json" },
377 body: JSON.stringify({ inputHash: sha256Hash }),
378 });
379
380 if (response.ok) {
381 const data = await response.json();
382 if (data.executionId) {
383 return data.executionId;
384 }
385 }
386 } catch (error) {
387 console.error("Failed to fetch execution ID:", error);
388 }
389
390 attempts++;
391 await new Promise(resolve => setTimeout(resolve, 500));
392 }
393
394 return null;
395 };
396
397 const executionId = await pollForExecutionId();
398

Callers 1

setupSSEFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected