mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-28 10:18:08 +02:00
fix: use simple sleep for server readiness, restore Windows parallelism
This commit is contained in:
parent
bc587208aa
commit
e63855ccf3
2 changed files with 3 additions and 16 deletions
|
|
@ -212,15 +212,8 @@ async def run_server_async(
|
|||
# Wait for server lifespan to be ready
|
||||
await server._started.wait()
|
||||
|
||||
# Wait for HTTP server to be ready by making a request
|
||||
url = f"http://{host}:{port}{path}"
|
||||
async with httpx.AsyncClient() as client:
|
||||
for _ in range(50): # 50 * 0.1s = 5s timeout
|
||||
try:
|
||||
await client.get(url, timeout=0.1)
|
||||
break
|
||||
except (httpx.ConnectError, httpx.TimeoutException):
|
||||
await asyncio.sleep(0.1)
|
||||
# Give uvicorn a moment to bind the port after lifespan is ready
|
||||
await asyncio.sleep(0.1)
|
||||
|
||||
try:
|
||||
yield f"http://{host}:{port}{path}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue