Z User commited on
Commit
64beda3
·
1 Parent(s): bedd72b

fix(apify): run-sync read timeout must cover the whole actor runtime (minutes)

Browse files
Files changed (1) hide show
  1. app/stores/apify.py +6 -1
app/stores/apify.py CHANGED
@@ -59,7 +59,12 @@ class ApifyClient:
59
  actor_ref = actor.replace("/", "~", 1) if "~" not in actor else actor
60
  url = f"/acts/{actor_ref}/run-sync-get-dataset-items"
61
  params = {"timeout": int(deadline * 1000)}
62
- res = await self.client().post(url, params=params, json=run_input)
 
 
 
 
 
63
  if res.status_code in (402, 403):
64
  raise RuntimeError(f"Apify rejected the run (HTTP {res.status_code}): {res.text[:200]}")
65
  res.raise_for_status()
 
59
  actor_ref = actor.replace("/", "~", 1) if "~" not in actor else actor
60
  url = f"/acts/{actor_ref}/run-sync-get-dataset-items"
61
  params = {"timeout": int(deadline * 1000)}
62
+ # run-sync holds the HTTP connection for the WHOLE actor runtime
63
+ # (minutes of Playwright scraping) — the 60s client default times out.
64
+ res = await self.client().post(
65
+ url, params=params, json=run_input,
66
+ timeout=httpx.Timeout(30.0, read=deadline + 60.0),
67
+ )
68
  if res.status_code in (402, 403):
69
  raise RuntimeError(f"Apify rejected the run (HTTP {res.status_code}): {res.text[:200]}")
70
  res.raise_for_status()