Skip to content

[backport/1.4] Improve frontend: Deduplicate system-information requests - #4034

Open
joaoantoniocardoso wants to merge 4 commits into
1.4-devfrom
backports/1.4/dedupe-system-information-requests
Open

[backport/1.4] Improve frontend: Deduplicate system-information requests#4034
joaoantoniocardoso wants to merge 4 commits into
1.4-devfrom
backports/1.4/dedupe-system-information-requests

Conversation

@joaoantoniocardoso

@joaoantoniocardoso joaoantoniocardoso commented Jul 25, 2026

Copy link
Copy Markdown
Member

This is a backport of #4027 into 1.4.

Subscribe only to cpu/memory/disk/temperature FetchTypes that have active consumers, and slow the always-on network poll to 2s.
Cpu, Disk, and CpuPie register only the system-information endpoints they display.
…ocal timer

Drop the duplicate 2s cpu/memory/disk interval and reuse shared store subscriptions.
Keep tray warnings and core-temperature reads fed without always-on temperature polling in the store.
@github-actions

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: MINOR SUGGESTIONS ✏️

Backport of #4027 into 1.4-dev. Replaces per-component setInterval polling in SystemCondition.vue, Cpu.vue, Disk.vue, and HealthTrayMenu.vue with a ref-counted subscribe/unsubscribe API in the system-information store that drives a single OneMoreTime task, coalescing overlapping fetches for CPU/memory/disk/temperature. Also lowers the network-info poll rate from 1 s to 2 s. Logic and cleanup on beforeDestroy look correct.

6. Code Quality & Style

  • 6.1 [minor] core/frontend/src/store/system-information.ts:275-281subscribeSystemInformation casts the task to any to inspect isPaused / isRunning / timeoutId, which are declared private in OneMoreTime (core/frontend/src/one-more-time.ts:50-56). This is fragile: a rename or refactor of those fields would silently break subscription bootstrapping (nothing would ever call start() again) and the eslint-disable hides it from lint. The reason the workaround exists is that OneMoreTime.start() isn't idempotent w.r.t. a pending timeoutId — calling start() while one is scheduled would leak a second timer. Cleaner alternatives, in order of preference: (a) add a public isActive() / isStopped() accessor on OneMoreTime; (b) make start() guard on this.timeoutId and clear it before re-scheduling so callers can invoke it unconditionally. Either would let this call site collapse to a single resume()-or-start() decision without reaching into internals.

9. Nitpicks / Optional

  • 9.1 [nit] core/frontend/src/store/system-information.ts:76 — the fetchSystemNetworkTask delay change (1000 ms → 2000 ms) is a behavioural change orthogonal to the "deduplicate requests" title. It's part of the upstream PR Improve frontend: Deduplicate system-information requests #4027 (matches its metrics table showing /system/network dropping from 60 → 30 hits/60 s) so the backport is faithful — just flagging it so reviewers don't miss that this PR also halves the network-info polling rate for anyone on the 1.4 line.

Generated by PR Review Bot. This is advisory, a human reviewer must still approve.

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.

1 participant