Fix duplicate listings via staged Redis cache and frontend stream cancellation
Three-pronged fix for duplicate listings appearing in the UI: 1. Backend: Replace direct rpush cache writes with staged population (write to temp key, then atomic RENAME to live key). Skip cache writes entirely for POI-enriched requests. Clean staging keys on invalidation. 2. Frontend: Add AbortController to cancel in-flight streaming requests when loadListings is called again, preventing data mixing. 3. Frontend: Deduplicate features by URL during stream accumulation as a safety net against any remaining server-side duplicates.
This commit is contained in:
parent
5b8aa98446
commit
73d19e29d5
5 changed files with 159 additions and 38 deletions
|
|
@ -268,7 +268,9 @@ class TestStreamListingGeoJsonEndpoint:
|
|||
|
||||
with patch("api.app.get_cached_count", return_value=None), \
|
||||
patch("api.app.ListingRepository", return_value=mock_repo), \
|
||||
patch("api.app.cache_features_batch"):
|
||||
patch("api.app.begin_cache_population", return_value="staging:test"), \
|
||||
patch("api.app.cache_features_batch_staged"), \
|
||||
patch("api.app.finalize_cache_population"):
|
||||
response = await async_client.get(
|
||||
"/api/listing_geojson/stream",
|
||||
params={"listing_type": "RENT"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue