fix(core): show flows live and keep finished flows listed - #53
Open
omarzeineddine-ai wants to merge 2 commits into
Open
fix(core): show flows live and keep finished flows listed#53omarzeineddine-ai wants to merge 2 commits into
omarzeineddine-ai wants to merge 2 commits into
Conversation
Two defects hid in-flight flows from the flows page (pontusab#26): - The flows result was cached for 2 minutes on an LRU with updateAgeOnGet: true, while the UI polls /api/flows every 5s. Each poll reset the entry's age, so the first snapshot (usually empty) was pinned forever and the page only changed after a server restart or a >2min pause in polling — by which time flows had completed, matching both user reports. Stop resetting TTL on access and align the flows TTL with the UI's 5s poll. - The per-queue prefilter only considered waiting/waiting-children/ active counts, while the job scan below deliberately includes completed and failed jobs. Once a flow finished and its queues went idle, the filter skipped every queue and the flow vanished from the list. Skip only truly empty queues instead. Verified against a live flow with 20s children: the flow now appears within one 5s poll of creation (status waiting-children) and remains listed as completed 4/4 after it finishes. Closes pontusab#26
|
@omarzeineddine-ai 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. |
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
Closes #26
Two users report the flows page stays empty while flows run, showing them only after completion. Reproduced exactly: with a flow whose children take 20s, the parent is visible as
waiting-childrenin the jobs API while/api/flowskeeps returning[].Two defects compound:
getFlowsresults are cached for 2 minutes on an LRU withupdateAgeOnGet: true, while the UI polls/api/flowsevery 5 seconds. Each poll resets the entry's age, so the first snapshot — usually empty — never expires. The page only changes after a server restart or a >2-minute pause in polling (navigate away, come back), by which time the flow has completed. That's precisely both reporters' experience.waiting/waiting-children/activejobs, while the job scan below deliberately fetchescompleted/failed/delayedjobs too. Once a flow finishes and its queues go idle, every queue is skipped and the flow vanishes from the list. The pinned cache masked this; fixing (1) alone would have made completed flows visibly disappear seconds after finishing.Solution
updateAgeOnGet: false— cache entries expire on their TTL instead of being pinned by reads.Note: the
updateAgeOnGetline is the same one-line change #41 makes for the overview page — the two PRs merge cleanly in either order and each stays correct standalone.Verification
Live flow with three 20-second children against docker Redis:
/api/flowsreturns[]while the parent sits inwaiting-children.waiting-children, 0/4), updates, and remains listed ascompleted4/4 after finishing.bun test,tsc --noEmit, and biome pass.No unit test added: the path is Redis-backed end to end and the repo has no BullMQ mocking infrastructure — the verification above is the regression check.