Migrate shared_db (sellers/market_comps) from SQLite to Postgres #44
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
Under load test (infra#12, 100 concurrent users),
GET /api/searchreturns 500s due tosqlite3.OperationalError: database is lockedin the post-scrape block.Root cause:
shared_db(sellers, market_comps) is a SQLite file. At 100 concurrent search requests, all writing seller data, the WAL write queue overflows the 30s busy timeout.Immediate fix:
e539427wraps the post-scrape block intry/except OperationalErrorand returns raw listings with empty trust scores (degraded mode) instead of crashing.Long-term fix
Migrate
shared_dbshared state (sellers, market_comps tables) to Postgres, reusing theCOMMUNITY_DB_URL/CommunityDBpattern already wired up for community signals.Keep per-user data (listings, trust_scores, saved_searches, alerts) in per-user SQLite — no write contention there.
Impact on enrich 504s
Separate issue:
POST /api/enrich504s are caused by eBay API connection timeouts (ConnectTimeoutError to api.ebay.com) backing up Playwright threads for 60s, hitting nginx proxy timeout. Fix: addconnect_timeoutto the eBay Browse API client, or cap enrich thread wall time before the proxy timeout.Labels:
bug,performance,database