Add timing to L1 request for debugging

Log how long requests.get() actually takes to identify network delays.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-09 03:38:27 +00:00
parent 3756f5e630
commit 32435fe291

View File

@@ -1788,9 +1788,12 @@ async def record_run(req: RecordRunRequest, user: User = Depends(get_required_us
# Helper to fetch from L1 without blocking event loop
def fetch_l1_run():
import time as _time
url = f"{l1_url}/runs/{req.run_id}"
logger.info(f"record_run: Fetching run from L1: {url}")
t0 = _time.time()
resp = requests.get(url, timeout=30)
logger.info(f"record_run: L1 request took {_time.time()-t0:.3f}s, status={resp.status_code}")
if resp.status_code == 404:
raise ValueError(f"Run not found on L1: {req.run_id}")
resp.raise_for_status()