Two scrapers calling match_or_create_house() concurrently for the same address could both miss Tier 0-3 and each INSERT a new canonical house — splitting listings across duplicate house rows and breaking aggregations. Serialize via pg_advisory_xact_lock(42, hashtext(fingerprint)). Lock is transaction-scoped (released on caller's COMMIT/ROLLBACK). After unblock, the losing scraper's Tier 2 fingerprint lookup hits the winner's alias and returns the same house_id. Closes finding #1 from 2026-05-24 trade-in audit. |
||
|---|---|---|
| .. | ||
| app | ||
| data/sql | ||
| tests | ||
| .dockerignore | ||
| Dockerfile | ||
| pyproject.toml | ||