Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6415f1869a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| fetch_accessable_projects = | ||
| Async.run(fn -> list_projects(org_id, user_id, tracing_headers) end) | ||
| case Async.await(task, timeout: @org_activity_timeout) do |
There was a problem hiding this comment.
Cancel descendant fetches when the org timeout fires
When an organization fetch exceeds 90 seconds—which is possible with the sequential, 30-second-per-page pipeline/debug pagination—this await shuts down only the fetch_org_activity/2 wrapper. The organization, project, pipeline, debug, and per-page job tasks it created with Task.Supervisor.async_nolink continue running independently; because the timeout result is not cached, the next browser poll starts another full fetch while those tasks are still active. Cancel all descendant tasks when the bound expires so a slow backend cannot accumulate overlapping RPC work.
Useful? React with 👍 / 👎.
| start_jobs = fn | ||
| [] -> nil | ||
| pipelines -> start_jobs_fetch(tracing_headers, org_id, ppl_ids_of(pipelines)) | ||
| end |
There was a problem hiding this comment.
Cancel page job tasks when pipeline pagination fails
If a later Plumber page fails after one or more successful pages, those earlier calls have already started Zebra job tasks here, but list_pipeline_pages/3 returns only the error and discards the partial pages containing their task handles. Consequently list_pipelines_and_jobs/2 exits without awaiting or shutting down those tasks; since the failed result is not cached, repeated polls during a pagination outage can accumulate redundant job-list RPCs. Retain and cancel the started tasks on the pagination error path.
Useful? React with 👍 / 👎.
e9a6f87 to
9d6e111
Compare
…lookups - Cache org-wide activity data for 5s per org with a single shared in-flight fetch; project visibility is still filtered per user. - Start the job lookup for each pipeline page while paging instead of after all pages, sending only that page's pipeline ids. - Replace list scans in the job, project, user and debug joins with map and set lookups; count hidden items without building them. - Return 503 JSON from /activity/data and render empty activity on page load when loading fails, instead of a 500.
…ancel abandoned lookups - Cache only the pipeline, block job and job fields the activity page and the agent stats read. Every cache read copies the entry, so the raw pipelines and jobs cost far more memory and time than the page needs. - The per-page job lookups of one load share a single budget of 10 zebra pages, the same limit as the previous single lookup. - Every task of an org fetch runs under a supervisor owned by that fetch and stopped when it ends, so an organization or project failure, a failed pipeline page or the fetch cap no longer leaves plumber and zebra lookups running in the background. The organization and projects are awaited before the first pipeline page is requested. - Start the users lookup right after paging, while the job lookups run. - The fetch cap can be set with :activity_monitor_fetch_timeout_ms.
- The job lookups of one load share a budget of 5,000 jobs, the same as the previous single lookup. Each lookup always gets its first page, so no pipeline page is left without jobs; later pages are fetched only while the load is under the budget, and an overshoot from lookups running in parallel is trimmed from the later pages. - ACTIVITY_MONITOR_FETCH_TIMEOUT_MS sets the fetch cap; a value that is not a positive integer falls back to the default. - Stopping a fetch's task supervisor that is already gone is not an error. - Tests clear the feature cache they fill, and the cancellation tests let in-flight mock requests settle before asserting silence.
d1a0212 to
ad813e3
Compare
Speeds up the Activity Monitor (
/activity,/activity/data) and/agentsfor organizations with many running pipelines. Org-wide activity data is cached for 5 seconds per organization with one shared in-flight fetch, so open tabs polling the same organization no longer each repeat the full fan-out. Project visibility is still filtered per user on every request.Job lookups now start per pipeline page while paging, and the job, project, user and debug joins use map lookups instead of list scans. When loading fails,
/activity/datareturns a 503 JSON error (the page keeps its last data) and the page renders empty activity instead of a 500. The response shape is unchanged.Tested: new tests for the cache (per-user filtering, shared fetch, errors not cached), per-page job lookups, and equivalence of the joins with the previous implementation;
fronttest suite,mix credo --allandmix format --check-formattedpass.