Replace notes polling with Action Cable
What does this MR do and why?
Updates notes in real time using websockets instead of polling. This improves the user experience since it does not need to take several seconds for the note changes to propagate. The other goal of this MR is to reduce the number of these HTTP requests because we process a lot of these polls: gitlab-com/gl-infra/scalability#2441 (comment 1488086853). This could also potentially reduce load on Redis.
The websocket is used to signal a note change and then we request the same endpoint used for polling to get the updated notes. This is done so minimal changes are needed.
This will eventually be changed to use GraphQL subscriptions, but I did this since we can get most of the benefits with just small code changes.
How to set up and validate locally
- Enable the
action_cable_notes
feature flag - Open an issue / MR / epic in two windows / browsers
- Add / update a note in one window
The updates should show up immediately on the other window. You can also verify in the network inspector that we are no longer continuously polling the notes
endpoint. We only make a request when a new note is added / updated.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.