Aggressive unconditional 5-second polling even when popout is closed (battery/CPU waste) #33
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The status timer runs at a fixed 5-second interval regardless of whether the widget popout is visible. This causes continuous
tailscale status --jsonprocess launches and JSON parsing even when the user is not interacting with the widget.Impact
Unnecessary CPU, memory, and (on laptops) battery drain for a background desktop widget that only needs fresh data when the popout is open.
Yeah, this is the second worst decision in @vybe's vibe-coded solution in my opinion. We don't need to poll Tailscale very often at all. I'd up this to 5-minute polling even, with triggers on actions that change state to repoll Tailscale.
The super-ideal state would be to monitor Tailscale for it's connected/disconnected state. Not sure the best way to go about this. Tailscale probably doesn't surface any system level events. However, maybe the kernel or networking stack does when the VPN is connected/disconnected. Don't know. Deserves research and thought. This might be worth checking how other Tailscale UIs for other desktop environments and window managers do this (i.e., KTailCtl for KDE).
However, even if hooking into some kind of system-wide trigger is too big a pain-in-the-ass and scope, we should still loosen the automatic polling drastically and instead poll the information we need, when we need it. Connected/disconnected would be fairly often. The peer list, however, is only needed when the popout is shown. We could probably build the popout with stale data or simply a loading notice, then query state and parse the peer list, then populate the popout.
Whatever. This is rambling. This just needs massive rework. 5 second iterations doing everything every time is overkill, bad practice, and causes other issues like double-toasting (#13).
Related: #11, #26, #30 — all stem from the unconditional 5 s status timer.
Added visible property guard: polling now only when popout open or on explicit user action. Human to-do: test battery impact on real device. Merged to vibes.
Resolved via merge
daab237(polling now guarded when popout closed). The plugin is confirmed working by @jtmorris. Human code review required before merging to testing.