Async search endpoint: return job_id immediately, scrape in background #49
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Search blocks the HTTP connection for 10-120s while Chromium scrapes eBay. Under load this exhausts FastAPI workers and causes 120s nginx timeouts (seen in spike #5 as max=120s ceiling failures).
Proposed Fix
Mirror the Peregrine async task pattern:
POST /api/search— enqueues scrape job, returns{job_id, status: "queued"}immediately (HTTP 202)GET /api/search/task/{job_id}— poll for status/resultsFrontend already handles async patterns (Peregrine cover letter polling) — adapt that component.
Expected Impact
Priority
Lower than browser pool + caching (those reduce actual latency); this improves resilience but does not fix root cause. Implement after #browser-pool lands.