Skip to content

Expire routine date-sequence caches at local midnight - #2628

Open
THEclaudi1 wants to merge 1 commit into
wger-project:masterfrom
THEclaudi1:fix-routine-sequence-midnight-cache
Open

THEclaudi1 wants to merge 1 commit into
wger-project:masterfrom
THEclaudi1:fix-routine-sequence-midnight-cache

Conversation

@THEclaudi1

Copy link
Copy Markdown

Proposed Changes

  • Carry the routine owner's local-midnight deadline with the calculated date sequence through the model cache and the display/gym API response caches.
  • Reject expired snapshots on read and avoid storing a snapshot if a request reaches the write after its deadline. Keep the normal cache timeout for routines that don't wait for logs and retain the existing per-requester separation in API cache keys.

A warm API response could continue showing the projected next workout after midnight even when the underlying routine calculation correctly stayed on the current workout. A request that begins just before midnight may finish with its original projection, but cannot cache that projection for later requests.

Validation

  • Added checks for both API endpoints across midnight, a request that spans midnight, the final fractional second, a 23-hour daylight-saving day, and warm responses for the owner and another signed-in user.
  • Ran all 397 manager tests with settings.ci and SQLite. Ruff lint and format checks passed.
  • No schema change or deployment step. The new cache keys avoid reusing warm entries created before the fix.

Prepared with AI assistance.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant