Skip to content

frontend: Stop NetworkSpeedTest reconnect interval multiply - #4032

Closed
joaoantoniocardoso wants to merge 1 commit into
masterfrom
pr/network-speedtest-interval
Closed

frontend: Stop NetworkSpeedTest reconnect interval multiply#4032
joaoantoniocardoso wants to merge 1 commit into
masterfrom
pr/network-speedtest-interval

Conversation

@joaoantoniocardoso

@joaoantoniocardoso joaoantoniocardoso commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary

  • Keep a single 200ms ping interval for the page lifetime.
  • On disconnect, only recreate the WebSocket (do not nest another setInterval).

Test plan

  • Open Tools → Network test, leave the page open with a flaky WS: interval count stays at one
  • Latency updates while connected; reconnect recovers without runaway timers
  • Leave the page: interval cleared, socket closed

Keep a single ping interval for the page lifetime and only recreate
the WebSocket on disconnect.
@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
@bluerobotics bluerobotics deleted a comment from github-actions Bot Jul 25, 2026
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as draft July 25, 2026 16:14
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as ready for review July 25, 2026 16:14
@github-actions

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: LGTM :shipit:

Fixes a real interval-leak bug in NetworkSpeedTest.vue: the previous openWebSocket() created a fresh setInterval on every call, and since the interval itself invoked openWebSocket() to reconnect on drops, each disconnect nested another timer (200 ms → 100 ms → 50 ms → …). The PR moves the single interval to mounted() and reduces the renamed connectWebSocket() to socket setup only, with a defensive this.websocket?.close() before reassigning. Cleanup in beforeDestroy() still clears the (now single) interval. Also worth noting: the early return after connectWebSocket() inside the tick correctly avoids the InvalidStateError you'd otherwise get from send() on a CONNECTING socket.

No further comments, nice job 👍

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 #4045 (same changes, head moved to fork joaoantoniocardoso/BlueOS-docker).

@joaoantoniocardoso

Copy link
Copy Markdown
Member Author

Closed in favor of #4045.

@joaoantoniocardoso
joaoantoniocardoso deleted the pr/network-speedtest-interval 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