Preload all protected branches for branches endpoint
The protected_branches association was being preloaded, but the all_protected_branches method is being used in some cases leading to N+1 queries for unloaded access level associations. Change all_protected_branches into an association so that it can be preloaded and used consistently.
显示
- app/models/project.rb 6 个添加, 10 个删除app/models/project.rb
- lib/api/branches.rb 1 个添加, 2 个删除lib/api/branches.rb
- lib/api/entities/branch.rb 2 个添加, 2 个删除lib/api/entities/branch.rb
- spec/lib/gitlab/import_export/all_models.yml 1 个添加, 0 个删除spec/lib/gitlab/import_export/all_models.yml
- spec/models/project_spec.rb 1 个添加, 0 个删除spec/models/project_spec.rb
- spec/models/protected_branch_spec.rb 4 个添加, 24 个删除spec/models/protected_branch_spec.rb
- spec/requests/api/branches_spec.rb 71 个添加, 2 个删除spec/requests/api/branches_spec.rb
加载中
想要评论请 注册 或 登录