Skip to content

Dataset search can serve a stale total for up to an hour after publishing #192

Description

@saqibmanan

What: /api/search/dataset/ can serve a stale total for up to an hour after a dataset is published.

Why it matters: search and the sitemap disagree, and the prod read-only check test_sitemap_datasets_count_matches_backend fails and rolls back the deploy.

Evidence: frontend prod deploy 35085603469 — sitemap 238 datasets, search total 237 before and after the crawl; minutes later every cache key read 238.

Fix: not fixed. Two likely causes in api/signals/dataset_signals.py / paginated_elastic_view.py, unconfirmed:

  • The version bump runs in pre_save, before the save commits and ES reindexes, so a search in that window re-caches the old count under the new version.
  • CACHES sets no TIMEOUT, so the version key expires after Django's default 300s and resets to 0, while results are cached for 3600s — old entries become reachable again.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions