Skip to content

Admin stats page efficiency#3778

Merged
rebeccacremona merged 1 commit into
developfrom
lazy-admin
Jun 5, 2026
Merged

Admin stats page efficiency#3778
rebeccacremona merged 1 commit into
developfrom
lazy-admin

Conversation

@jcushman
Copy link
Copy Markdown
Contributor

@jcushman jcushman commented Jun 4, 2026

The admin stats page polls /manage/stats/celery_queues every 2 seconds, which adds up to a real amount of traffic in the logs. For efficiency:

  • Add start/stop buttons for celery queues to match the other stats sub-tabs
  • Lazy load sub-tabs, so no data is loaded for unused tabs
  • Disable polling when document is not visible to user (document.hidden)
  • Disable polling when sub-tab not selected (so if you click the start button and switch sub-tabs, that tab doesn't poll until you switch back)

This way it not only doesn't start automatically, but if you do start and then move away, it and other sub-tabs don't keep pointlessly going in the background.

This PR is AI coded and not tested by me. In my defense: I discussed this with Becky and it sounds like this contribution is useful; it's a low risk staff-only page, easy to apply (if you have Perma up and running locally) and check if it works. Feel free to take it over, or if it's wrong in some complicated way, reject without looking too hard.

… when document.hidden or sub-tab not selected
@jcushman jcushman requested a review from rebeccacremona June 4, 2026 23:50
Copy link
Copy Markdown
Contributor

@rebeccacremona rebeccacremona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm into it.

If it breaks the page, it breaks the page, and I'll fix it Monday.

@rebeccacremona rebeccacremona merged commit 56165b8 into develop Jun 5, 2026
2 checks passed
@rebeccacremona rebeccacremona deleted the lazy-admin branch June 5, 2026 13:16
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