fix(tailscale): project status JSON fields before Luau decode - #439
nicobonada wants to merge 2 commits into
Conversation
After the Mullvad Peer filter, leftover objects still carry unused fields (sshHostKeys, CapMap, …). Keep the same filter, then pick only the fields parseStatus reads. Skip state.set when nothing changed.
|
CC @davemhammer |
Rx/Tx counters in the field projection changed every poll under traffic and forced a full decode even though the panel never shows them. Drop those fields and reuse the last parse when the raw command strings match.
|
Follow-up commit on this same branch — the first one still blew Noctalia's 25ms plugin CPU budget on a loaded machine.
Still the |
|
waiting on original author's approval |
|
@davemhammer last call before I review and merge if all is good. |
The new raw-equality early return in applyBag() runs before the error bookkeeping, and it also clears Observed result, compared against main with a stubbed host driving the real service module: main reports
Gating publishSnapshot() on the revision signature means any field the UI reads that is not part of that Same A/B run: with the selected exit node flipping to offline and the peer set unchanged, main publishes |
|
@ItsLemmy Even with the changes in this PR, the plugin still dies under heavy load (last time was during compiling shaders in a game). I'm inclined to close the PR and use the tailnet plugin going forward because further optimization is above my pay grade. |
Plugin
davemhammer/tailscaleplugin.toml)What it does
Follow-up to #362. That PR filters unused Mullvad exits out of
tailscale status --jsonbefore Luau decodes it. The leftover JSON is still fat: each remaining peer carriessshHostKeys,SelfcarriesCapMap, and so on — fieldsparseStatusnever reads.On a loaded machine that leftover decode plus
state.setof the snapshot can still exceed Noctalia's 25ms plugin CPU budget, which auto-disables the service (script callback 'async command callback' exceeded its CPU budget).This keeps the existing Mullvad
Peerfilter as-is, thenjqs the same pipe down to the fields the service actually uses (same idea as the existingdebug prefsprojection).state.setis skipped when the snapshot signature did not change. Version1.0.6→1.0.7.External dependencies
Unchanged:
tailscale,jq,xdg-open.jqalready filteredstatus --jsonafter #362; it now also projects fields, still in that one pipe.Testing
Reproduced the CPU-budget
apply failedlog on Niri / NixOS with Mullvad exits in the netmap (rawstatus --json~870 KB / 560 peers; after #362 ~15 KB; after this projection ~3.2 KB / 7 real machines). After the change,noctalia msg plugin davemhammer/tailscale:service all refreshsucceeds and the bar/panel still show real machines plus the exit-node list.Screenshots / Videos
None — no UI change. Same bar/panel; smaller JSON on the existing
jqpipe.Checklist
idafter the/inplugin.tomlexactly.plugin.toml,README.md,thumbnail.webp, andtranslations/en.json.README.mdfollows theREADME template, documents
every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.
thumbnail.webpwith the thumbnail generator. (unchanged; not a new plugin)versionfollows semver and is bumped in this PR;plugin_apiis the oldest API level this plugin requires.understand that language well enough to review and maintain it (no unreviewed machine/LLM translations). (no locale files touched)
catalog.toml; CI generates it.Code review attestation
licensedeclared inplugin.toml.