Improve polling on MRs when tab/window is inactive
Problem to solve
Recently we addressed a problem that was causing inactive tabs to keep hammering the servers looking for updates:
- Disabling polling when tab is inactive !26626 (merged)
However, this has some side-effects like not updating the favicon for the CI pipelines.
We'd like to iterate and improve this while still achieving the same goal, decrease needless load on the BE servers.
Further details
Before we kept the same strategy when the user moved away from the tab.
After !26626 (merged) we completely halted the requests.
Proposal
Find a middle ground and:
- re-enable polling but on each polling-request, increase exponentially the polling interval.
Also:
- Add this behavior behind a feature flag, default to true, to allow instance owners to disable this behavior.
Availability & Testing
Since this behavior will affect the MR page when the user has walked away from it, it should only decrease the load on the servers.
We should add some tests mocking the scenario of user moving away from tab. (mocking Visibility API?) And checking the behavior is the desired one.
What does success look like, and how can we measure that?
An inactive tab should not be causing unnecessary load, while still remaining relatively "alive" to reflect updates on Pipelines.