Repository navigation
Refresh agent usage once for every monitor - #20906
Closed
omarchybot wants to merge 3 commits into
Closed
omarchybot wants to merge 3 commits into
omarchybot wants to merge 3 commits into
Conversation
The bar builds the agents panel once per monitor, and each copy's timer ran the usage updater itself, so a second monitor meant a second refresh of every collector each interval, and a monitor plugged in later started one of its own. The copies share one module, which names the first copy to tick as the owner of the timed refresh and the limits retry; the rest start none, and the next copy takes over when the owner goes. A finished update has every copy look again, since only the copy that ran it would otherwise see a new agent's record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The copies that ran no update of their own were rescanned and reloaded but never rescheduled their sync or limits retry, so with synced aggregation on a second monitor's totals could freeze after an update that changed no record's content, and a retry the owner had not armed could wait out the interval. Each copy now runs the same afterUpdate, which also keeps the owner's own records current, so it arms the same retry any other copy would. Co-Authored-By: Opus 5.5 High <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found in the reviewed changes. SummaryThe agents panel shares timed usage refreshes across monitors through
No new actionable issues were found. Tests were not run during this review.
|
The owner is the oldest copy still on the list, so there is no claim to make or hand back: when its monitor goes, the next copy is first. finishUpdate runs afterUpdate over every copy, itself included. The logic is tested by driving the module and finishUpdate directly, which replaces the QML fixture that tested a few lines of change with a stub updater and kept the whole file off the non-compositor shards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Closing at the maintainer's direction: the saving is real but too small to carry the code. Each extra monitor's duplicate refresh costs about 8 to 30 CPU-seconds every 15 minutes, and since #19026 and #19831 it runs two collectors at a time at idle priority, so nobody sees it. The stutter that made the duplication matter in #18973 is fixed by those two. |
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.
The bar builds the agents panel once per monitor, and each copy's usage model ran
omarchy-agent-usage-updateon its own timer. Two monitors meant two full refreshes of every collector each interval, and a monitor plugged in later started one of its own. The collectors already run two at a time at idle priority, so what this costs is CPU time and energy rather than stutter, but it is all wasted: every copy reads the same records.The copies now share one
.pragma librarymodule,RefreshOwner.js, which the shell loads once for all of them and which keeps the list of copies. The oldest copy still on it owns the timed refresh and the limits retry; the others start none. When the owner goes with its monitor, the next copy is the oldest. Since the other copies no longer run updates of their own, a finished update has every copy run the sameafterUpdate: look for new records, reload them, and re-arm its sync and limits retry. That also keeps the owner's records current, so it arms the same retry any other copy would. Refreshes a person asks for, opening the panel or the refresh button, are not gated.Each copy still watches and parses the records itself. They are small, about 25 KB in all on a heavy user's machine, so sharing those too, by making the model a plugin service, would buy little and cost the panel under replacement bars, which reach no service; that version is closed as #20897. This supersedes #17955, where silversword411 found and measured the duplication; its lock only joined refreshes that overlapped in time, so copies drifted apart after a hot-plug.
On a worker built from the ISO with two outputs, a shell start ran one updater and 23 collectors in each of three restarts, where
quattroran two and 46; plugging in a third output started none; unplugging one again left the next refresh running cleanly; a refresh from the command line still ran.Reviewed by Opus 5.5 High and muse-wonder (High, via pi) as second opinions, reading the tree, in three rounds. They found that the other copies were rescanned after an update but never re-armed their sync or limits retry, which would have frozen a second monitor's synced totals; each copy now finishes the update the same way. The later rounds found nothing further.
No visible change: the panel draws the same; only how many refreshes run changes.
🤖 Generated by Opus 5.5 in Claude Code. Reviewed by Opus 5.5 High and muse-wonder High.