Skip to content

Improve frontend 2: Deduplicate /status requests - #4026

Open
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:fix_frontend_deterioration_over_time_2
Open

Improve frontend 2: Deduplicate /status requests#4026
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:fix_frontend_deterioration_over_time_2

Conversation

@joaoantoniocardoso

@joaoantoniocardoso joaoantoniocardoso commented Jul 24, 2026

Copy link
Copy Markdown
Member

When checking the Network tab in Chrome devtools, there was a pile of /status requests being fired. Digging in, every axios call was first checking whether the backend was online with an extra request. Example:

image

This patch works around that with a short time-based cache (3 seconds, same as BackendStatusChecker) so we only actually hit /status when the cache is stale, and only one of those checks runs at a time while others wait on it or reuse the last "online" result.

Example after:
image

When the backend gets online, we now have a few requests that will fail while the 3-second cache is valid:

image

But once it gets back online, it returns to normality:
image

This happens equally in both 1.4 and 1.5, and the impact on performance is probably minimal in most cases. It reduces the overall latency and reduces simultaneous connections, which is helpful when we expect low-grade connections as well.

@github-actions

This comment was marked as resolved.

@joaoantoniocardoso
joaoantoniocardoso force-pushed the fix_frontend_deterioration_over_time_2 branch from 26627fa to 7f04760 Compare July 24, 2026 23:57
@joaoantoniocardoso joaoantoniocardoso added the move-to-stable Needs to be cherry-picked and move to stable label Jul 24, 2026
Every back_axios call used to hit /status first, which piled up under
normal polling. Cache a recent online result for 3s (same as
BackendStatusChecker) and share one in-progress check so we only
actually request when the cache is stale.
@joaoantoniocardoso
joaoantoniocardoso force-pushed the fix_frontend_deterioration_over_time_2 branch from 7f04760 to 25ced82 Compare July 28, 2026 01:34
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.

1 participant