Skip to content

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

Merged
joaoantoniocardoso merged 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:pr/gate-network-platform-polling
Jul 30, 2026
Merged

frontend: Gate network and platform polling by FetchType#4049
joaoantoniocardoso merged 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:pr/gate-network-platform-polling

Conversation

@joaoantoniocardoso

@joaoantoniocardoso joaoantoniocardoso commented Jul 27, 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

Supersedes #4029 (recreated from fork joaoantoniocardoso/BlueOS-docker instead of same-repo head).

@github-actions

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: MINOR SUGGESTIONS ✏️

Gates SystemNetworkType and PlatformType polling on active subscribers instead of always-on tasks. system-information/Network.vue, widgets/Networking.vue, HealthTrayMenu, VehicleInfo and DevicePathHelper now subscribe/unsubscribe explicitly. A stable network_interface_names list is exposed so the App tray widget list only rebuilds when the set of interface names changes, and the tray :key moves from index to widget_name. Overall correct and well-scoped; a few minor hygiene notes below.

1. Correctness & Implementation Bugs

  • 1.1 [minor] core/frontend/src/store/system-information.ts:75-79fetchPlatformTask now uses autostart: false, so system_information.platform is only populated once at least one subscriber mounts. This is intentional, but note that in full_page_requested mode (App.vue:2) HealthTrayMenu is not rendered, so any full-page route that reads platform (e.g. via VehicleInfo inside a full-page overview) must subscribe on its own. VehicleInfo and DevicePathHelper do — worth double-checking any other full-page consumer stays subscribed.
  • 1.2 [minor] core/frontend/src/store/system-information.ts:391 — the boot-time system_information.fetchSystem() is now the only path that populates system.network (and therefore network_interface_names) before any subscriber exists. If that first call fails (e.g. backend not yet up), the App tray context-menu will show no Networking widgets until a subscriber triggers a re-fetch. The recursive SystemType fallback inside fetchSystemInformation kicks in as soon as HealthTrayMenu subscribes, so this recovers in the normal app path — but it is a behavior change vs. the previous always-on fetchSystemNetworkTask that used to serve as a de-facto retry.

6. Code Quality & Style

  • 6.1 [minor] core/frontend/src/store/system-information.ts:195-203resumeOrStart reaches into OneMoreTime's private fields (isPaused, isRunning, timeoutId) via as any. The pattern pre-existed in subscribeSystemInformation; consolidating it here is fine, but consider adding a small public accessor on OneMoreTime (e.g. isIdle()) so a future rename of those private fields can't silently break the store.
  • 6.2 [nit] core/frontend/src/store/system-information.ts:189-192 — the second names.every((name) => previous.includes(name)) clause in nextNetworkInterfaceNames is redundant when interface names are unique (length equality + one-sided subset already implies set equality). Only necessary if duplicates are possible, which they aren't for interface names.

8. Documentation

  • 8.1 [nit] core/frontend/src/components/system-information/Network.vue:42 — the [...networks] copy-before-sort is a real fix (previous .sort() mutated the Vuex state array) but is bundled with the polling refactor. Splitting it into its own commit would keep git blame/git bisect clean; the inline WHY comment is good either way.

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 27, 2026
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 29c5d54 to 0b042a7 Compare July 28, 2026 01:34

@Williangalvani Williangalvani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice!

@joaoantoniocardoso
joaoantoniocardoso merged commit 4c010c0 into bluerobotics:master Jul 30, 2026
7 checks passed
@joaoantoniocardoso
joaoantoniocardoso deleted the pr/gate-network-platform-polling branch July 30, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

move-to-stable Needs to be cherry-picked and move to stable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants