Skip to content

Commit 94d9632

Browse files
committed
Allow retries
1 parent bd1ec4e commit 94d9632

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Framework/Core/scripts/hyperloop-perf-server/perf_mcp_server.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,14 @@ async def load_profile(url: str, name: str = "", token: str = "", proxy_token: s
197197
headers["Accept-Encoding"] = "identity"
198198

199199
async with httpx.AsyncClient(verify=False) as client:
200-
r = await client.get(fetch_url, headers=headers, timeout=120.0, follow_redirects=True)
201-
r.raise_for_status()
200+
for attempt in range(3):
201+
try:
202+
r = await client.get(fetch_url, headers=headers, timeout=300.0, follow_redirects=True)
203+
r.raise_for_status()
204+
break
205+
except (httpx.RemoteProtocolError, httpx.ReadError) as exc:
206+
if attempt == 2:
207+
raise
202208
text = r.content.decode("utf-8", errors="replace")
203209

204210
profile = await asyncio.get_event_loop().run_in_executor(None, _parse, text)

0 commit comments

Comments
 (0)