Cache only the discussions of diff notes that we will use in response
What does this MR do and why?
When we are calling the discussions endpoint, we call load_highlight
this will loop through the discussions diff notes and highlight all of the discussions, not just the ones we are showing. This highlighting is expensive, and when we have a lot of diff notes, it can cause a 500 error.
However, what we could do instead is only highlight the discussions that will be returned. This will help distribute the load of highlighting over multiple different requests, rather than the first request doing a large chunk of the work.
To Test:
- Create 30-40 diff discussions
- Load the MR, and in the performance bar, check the number of the keys in the redis call (should contain all the ids)
- Turn to
only_highlight_discussions_requested
on - Refresh, and check that the discussions load as normal and check number of keys is not everything
Feature flag off:
Feature flag on:
Related to: #378605 (closed)
Edited by Marc Shaw