MCPcopy
hub / github.com/aiming-lab/MetaClaw / wait_for_proxy

Function wait_for_proxy

scripts/run_e2e_skills_memory_test.py:49–64  ·  view source on GitHub ↗

Wait until the proxy is ready.

(timeout_s=60)

Source from the content-addressed store, hash-verified

47
48
49async def wait_for_proxy(timeout_s=60):
50 """Wait until the proxy is ready."""
51 url = f"http://127.0.0.1:{PROXY_PORT}/docs"
52 start = time.monotonic()
53 while True:
54 try:
55 async with httpx.AsyncClient(timeout=3.0) as client:
56 resp = await client.get(url)
57 if resp.status_code < 500:
58 logger.info("Proxy ready (status=%d)", resp.status_code)
59 return
60 except Exception:
61 pass
62 if time.monotonic() - start > timeout_s:
63 raise TimeoutError("Proxy did not start in time")
64 await asyncio.sleep(1.0)
65
66
67async def send_chat(messages, session_id="test_session_001", session_done=False):

Callers 1

run_testFunction · 0.70

Calls 2

getMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected