Cache list of conflicts when serializing diffs
What does this MR do and why?
When we serialize diffs and the MR has conflicts, we make a ListConflictFiles
RPC call to Gitaly. We use this to determine what type of conflict file/s in the diffs is encountered.
This RPC can take a while if we're requesting this every request and there are no actual changes.
To improve performance for succeeding requests, we introduce a new #conflicts_with_types
helper which will cache the result and will use the cached result until source/target branch changes.
Caching functionality is behind cached_conflicts_with_types
feature flag.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Enable
cached_conflicts_with_types
feature flag. - Create a MR with conflicts.
- View the "Changes" and you should see the conflict type (as documented in https://docs.gitlab.com/ee/user/project/merge_requests/changes.html#show-merge-request-conflicts-in-diff).
- Reload the MR page.
- Check
pb
and thediffs_batch.json
anddiffs_metadata.json
requests shouldn't have any requests toListConflictFiles
RPC.
Related to #439695 (closed)