Skip to content

Eager load project relations in IssueParser

yorickpeterse-staging requested to merge eager-loading-issue-parser into master

What does this MR do?

This changes the ReferenceParser class to eager load various associations. This in turn results in the permissions checking code (e.g. the Ability model) to not run dozens if not hundreds of extra SQL queries depending on the amount of references involved (in a single document).

Are there points in the code the reviewer needs to double check?

No.

Why was this MR needed?

In !4410 (merged) it was revealed a lot of a queries came from the Ability model and the code it would call. In many cases this was because the code would simply get a project, then get the owners; or get a group, then get some association of that. Eager loading these associations is a fairly simple solution and greatly cuts down the number of queries.

What are the relevant issue numbers?

None.

Does this MR meet the acceptance criteria?

Merge request reports