fix(core): keep overview & queue list live (don't pin cache on read)#41
Open
omar-zeineddine wants to merge 1 commit into
Open
fix(core): keep overview & queue list live (don't pin cache on read)#41omar-zeineddine wants to merge 1 commit into
omar-zeineddine wants to merge 1 commit into
Conversation
|
@omar-zeineddine is attempting to deploy a commit to the Pontus Abrahamsson's projects Team on Vercel. A member of the Team first needs to authorize it. |
6b2fb54 to
602b11a
Compare
The QueueManager LRU cache used `updateAgeOnGet: true`, which resets an entry's TTL on every read. The dashboard polls the overview and queue list continuously, so those entries were re-read before their TTL elapsed and never expired — the overview showed stale data indefinitely, even across hard refreshes (pontusab#25). - Disable `updateAgeOnGet` so entries expire on their TTL. - Shorten `overview`/`queues` TTL to 5s to match the frontend's 5s poll cadence (counts are already gated by the 5s countCache). - Invalidate `queues`/`overview` on pause/resume so queue control reflects immediately, consistent with retry/remove/promote. - Also drop the derived `queues` entry in invalidateJobCache (overview is computed from it). Fixes pontusab#25
602b11a to
9d6b7f3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #25 — the Overview page never updates live: it stays static even after a hard refresh, while the Runs page updates fine.
Root cause
QueueManager's LRU cache is created withupdateAgeOnGet: true, which resets an entry's TTL on every read. The dashboard polls/api/overviewand the queue list every 5s (useOverview→refetchInterval: 5000), whileoverview/queueshave a 2-minute TTL. So those entries are re-read long before they expire, their age keeps resetting, and they never expire — the first snapshot is served indefinitely. Because it's a server-side cache, a browser hard refresh doesn't help (matches the report).The Runs page is unaffected because
getAllRuns/getLatestRunsaren't cached.metrics(5m TTL, polled every 30s) andquick-countshad the same latent issue.A related symptom:
pauseQueue/resumeQueuedon't invalidate any cache (unlikeretryJob/removeJob/promoteJob), so pausing/resuming a queue isn't reflected in the overview or queue list.Fix
updateAgeOnGet: false— entries expire on their TTL instead of being pinned by reads.overview/queuesTTL 2m → 5s, matching the frontend's 5s poll cadence. Job counts are already gated by the existing 5scountCache, so this doesn't add meaningful Redis load.queues/overviewafterpauseQueue/resumeQueueso queue control reflects immediately.invalidateJobCachenow also drops the derivedqueuesentry (the overview is computed from it).Verification
bunx tsc --noEmitinpackages/core— passes.biome checkon the changed file — clean.