Skip to content

Cache only the discussions of diff notes that we will use in response

Marc Shaw requested to merge remove_load_highlight_call into master

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:

Screenshot_2023-11-02_at_12.38.23

Feature flag on:

Screenshot_2023-11-02_at_12.38.55

Related to: #378605 (closed)

Edited by Marc Shaw

Merge request reports

Loading