Skip to content

frontend: Gate network and platform polling by FetchType - #4029

Closed
joaoantoniocardoso wants to merge 1 commit into
masterfrom
pr/gate-network-platform-polling
Closed

frontend: Gate network and platform polling by FetchType#4029
joaoantoniocardoso wants to merge 1 commit into
masterfrom
pr/gate-network-platform-polling

Conversation

@joaoantoniocardoso

@joaoantoniocardoso joaoantoniocardoso commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary

  • Refcount SystemNetworkType and PlatformType like other system-info polls (drop always-on network task; gate platform task).
  • Subscribe from Networking widgets / Network tab / HealthTray / VehicleInfo / DevicePathHelper.
  • Keep a stable network_interface_names list so App tray widgets do not rebuild on every speed update.
  • Also switches App tray :key from index to widget_name (stable under drag reorder).

Test plan

  • Open BlueOS with HealthTray mounted: PlatformType still polls; CPU/Disk/etc. only when widgets subscribed
  • Enable eth0 Networking widget: SystemNetworkType polls; disable widget: polling stops (if no other network subscribers)
  • Tray widget list does not flicker/rebuild every 2s under steady traffic
  • Rename/hotplug iface (or swap names at same count): tray updates to new interface names
  • Vehicle setup DevicePathHelper / VehicleInfo still get platform info

@joaoantoniocardoso
joaoantoniocardoso force-pushed the pr/gate-network-platform-polling branch from 25b92b8 to d48a27b Compare July 25, 2026 14:42
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as draft July 25, 2026 15:51
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as ready for review July 25, 2026 15:51
@joaoantoniocardoso
joaoantoniocardoso force-pushed the pr/gate-network-platform-polling branch from d48a27b to 248cadc Compare July 25, 2026 16:23
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as draft July 25, 2026 16:23
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as ready for review July 25, 2026 16:23
@joaoantoniocardoso

Copy link
Copy Markdown
Member Author

Addressed from the latest review:

  • Removed dead fetchNetworkInformation
  • Extracted nextNetworkInterfaceNames and hasSystemSubscribers

Refcount SystemNetworkType and PlatformType like other system-info
polls, subscribe from Networking widgets / Network tab / HealthTray, and
keep a stable iface-name list so App tray widgets do not rebuild on
every speed update.
@joaoantoniocardoso
joaoantoniocardoso force-pushed the pr/gate-network-platform-polling branch from 248cadc to aaf8e9a Compare July 25, 2026 16:30
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as draft July 25, 2026 16:32
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as ready for review July 25, 2026 16:32
@bluerobotics bluerobotics deleted a comment from github-actions Bot Jul 25, 2026
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as draft July 25, 2026 16:36
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as ready for review July 25, 2026 16:36
@joaoantoniocardoso
joaoantoniocardoso force-pushed the pr/gate-network-platform-polling branch from aaf8e9a to 29c5d54 Compare July 25, 2026 16:43
@bluerobotics bluerobotics deleted a comment from github-actions Bot Jul 25, 2026
@joaoantoniocardoso

Copy link
Copy Markdown
Member Author

Restored this branch after an accidental force-push race that briefly replaced it with the #4028 tip. Diff is again the FetchType gating work (not the linux2rest rate rewrite).

@joaoantoniocardoso
joaoantoniocardoso marked this pull request as draft July 25, 2026 16:43
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as ready for review July 25, 2026 16:43
@github-actions

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: MINOR SUGGESTIONS ✏️

Converts SystemNetworkType and PlatformType polling to the refcounted subscribeSystemInformation/unsubscribeSystemInformation pattern already used by CPU/Disk/Memory/Temp, wires the relevant subscribers (Networking widget, Network tab, HealthTrayMenu, VehicleInfo, DevicePathHelper), and introduces a stable network_interface_names snapshot so the App tray widget list only rebuilds when the interface set actually changes. Also switches the App tray v-for key from index to widget_name and fixes an in-place sort on the Vuex-owned network array.

6. Code Quality & Style

  • 6.1 [nit] core/frontend/src/store/system-information.ts:195resumeOrStart now reaches into three private fields on OneMoreTime (isPaused, isRunning, timeoutId) through an as any cast. The check exists because a plain task.start() while a timeoutId is already queued would double-schedule, and task.resume() is a no-op when the task is only in the "never started" state. This pattern predates the PR but is now the only caller left; consider promoting it to a public OneMoreTime.startOrResume() (or restart()) method in core/frontend/src/one-more-time.ts so the store stops depending on OneMoreTime internals.
  • 6.2 [nit] core/frontend/src/store/system-information.ts:186nextNetworkInterfaceNames compares sets with two nested .includes() calls (O(n²)). Fine for a handful of interfaces, but a single previous.every((n) => names.includes(n)) after the length check is equivalent when names are unique (which they are here). One direction can be dropped.

8. Documentation

  • 8.1 [nit] core/frontend/src/App.vue:497 — the removed comment (// lets filter out docker, veth, and zerotier interfaces) was already inaccurate — the filter is ['docker', 'lo', 'veth'], no zerotier — and the new comment only explains why the interface-name list is used instead of system.network. A one-liner naming what the prefix filter excludes (docker/lo/veth) would keep the intent visible to future readers.

9. Nitpicks / Optional

  • 9.1 [nit] core/frontend/src/store/system-information.ts:187network_interface_names is exposed as a raw store field; only App.vue reads it. If more callers appear, wrap it behind a getter to make the "stable list" contract explicit and to keep the field name discoverable via IDE go-to-definition on the store type.
  • 9.2 [nit] App tray widgets keyed by widget_name is the right call for drag reorder stability; note that if settings.user_top_widgets ever persists a name whose interface has since been removed, getWidget() returns a { component: null } placeholder that will still occupy a slot in the row. Not new to this PR, but worth a small guard in a follow-up (filter selected_widgets by topWidgetsName in the template) since this PR touches the same computed.

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

@joaoantoniocardoso joaoantoniocardoso added the move-to-stable Needs to be cherry-picked and move to stable label Jul 25, 2026
@joaoantoniocardoso

Copy link
Copy Markdown
Member Author

Superseded by #4049 (same changes, head moved to fork joaoantoniocardoso/BlueOS-docker).

@joaoantoniocardoso

Copy link
Copy Markdown
Member Author

Closed in favor of #4049.

@joaoantoniocardoso
joaoantoniocardoso deleted the pr/gate-network-platform-polling branch July 27, 2026 21:03
@joaoantoniocardoso joaoantoniocardoso removed the move-to-stable Needs to be cherry-picked and move to stable label Jul 27, 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.

1 participant