Skip to content

Conversation

@betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Nov 25, 2025

SUMMARY

Contribution charts were getting cache misses on force_cached=True because the totals query used in post-processing kept its original row_limit (e.g., 1000) when building cache keys on fetch, while the cached entry was produced with row_limit=None during async computation. This mismatch could trigger unnecessary async jobs and redundant totals recalculations.

This change introduces a normalization helper that always sets the totals query row_limit to None before cache-key generation, even for force-cached reads, and reuses that helper inside ensure_totals_available to avoid duplicated logic. The force-cached path now aligns cache keys without executing totals, and a unit test verifies the totals query is normalized without running a new totals query, preserving expected cache hits.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@betodealmeida betodealmeida changed the title Row limit cache fix fix: normalize totals cache keys for async hits Nov 25, 2025
@betodealmeida betodealmeida force-pushed the row_limit-cache-fix branch 2 times, most recently from d81618a to f45c0f4 Compare November 25, 2025 21:40
@betodealmeida betodealmeida marked this pull request as ready for review November 25, 2025 21:40
@dosubot dosubot bot added the change:backend Requires changing the backend label Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:backend Requires changing the backend size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant