Skip to content

Bug 1499551 - Bound jobs-view memory: per-repo push cap + idle-timeout polling (part 2/3)#9705

Open
camd wants to merge 8 commits into
masterfrom
camd/bug-1499551-push-eviction-cap
Open

Bug 1499551 - Bound jobs-view memory: per-repo push cap + idle-timeout polling (part 2/3)#9705
camd wants to merge 8 commits into
masterfrom
camd/bug-1499551-push-eviction-cap

Conversation

@camd

@camd camd commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Part 2 of 3 addressing Bug 1499551 (jobs-view memory growth over time). Expanded per team discussion to also bound background-tab lifetime.

1. Per-repo rolling push cap

On a watched tree the 60s poll appends pushes and their jobs with no eviction, so pushList/jobMap/decisionTaskMap and the per-<Push> job state grow unbounded. Now:

  • Rolling cap on retained pushes: 200 for autoland, 100 for other repos (getRepoPushCap).
  • Cap-polling-only: the cap is a floor; explicit "get more pushes" loads still raise the limit, so users can browse deeper history. Polling-driven growth is evicted back to the cap (oldest first), pruning those pushes' jobs — which is what reclaims the memory.
  • The selected push and any push with a pinned job are never evicted.

2. Stop polling forgotten background tabs (idle timeout + keep-alive)

  • A tab left in the background (Page Visibility hidden) stops the push/job poll after 2 hours of continuous inactivity. Bringing it back to the foreground resumes polling (with one catch-up poll) and resets the clock.
  • A keep-alive toggle (a coffee mug) in the jobs-view toolbar extends that window to 12 hours for a tab you intend to leave open. Per-tab, default off, not persisted.
  • Only the push/job poll stops; app-level intervals (deployed-version check, notifications) keep running.

New pieces: pollControlStore (per-tab keepAlive/pollingPaused), usePollingLifecycle hook (interval + visibility idle logic, extracted from PushList for isolated testing), and KeepAliveButton.

Testing

  • Per-repo cap: getRepoPushCap, enforcePushLimit eviction + selected/pinned protection + jobMap pruning, floor applied on fetchPushes, trim after pollPushes.
  • Idle timeout: usePollingLifecycle with fake timers + simulated visibility changes — stops after the limit while hidden, resumes + catch-up on refocus, refocus resets the clock, keep-alive extends to 12h.
  • pollControlStore and KeepAliveButton (toggle + paused indicator).
  • Full frontend unit suite passes; lint clean.

Part 3 (#9706) is stacked on this branch.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.67%. Comparing base (6a820e6) to head (8190206).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
ui/shared/stores/pushesStore.js 93.93% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9705   +/-   ##
=======================================
  Coverage   82.66%   82.67%           
=======================================
  Files         626      626           
  Lines       36753    36784   +31     
  Branches     3348     3338   -10     
=======================================
+ Hits        30383    30412   +29     
- Misses       5988     5989    +1     
- Partials      382      383    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@camd camd changed the title Bug 1499551 - Cap retained pushes to bound jobs-view memory (part 2/3) Bug 1499551 - Bound jobs-view memory: per-repo push cap + idle-timeout polling (part 2/3) Jul 21, 2026
@camd camd self-assigned this Jul 24, 2026
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.

2 participants