Optimize JIRA ref lookup
In a project with JIRA activated, `ProcessCommitWorker` attempts to add a comment to a JIRA issue if that issue is mentioned in a commit. However, the JIRA integration would attempt to retrieve all tags and branches and pick the first matching ref given a commit OID. The problem with that approach is that after each push, the list of all branches and tags are expired and could take a while to gather. Since multiple `ProcessCommitWorker` jobs can be running at the same time, this can lead to high I/O on Gitaly nodes since multiple `ProcessCommitWorker` jobs can run at the same time. We observe that we don't really need to build the entire ref list; we can just ask Gitaly for a single matching ref for the given OID with the newly-created `FindRefsByOID` RPC introduced in https://gitlab.com/gitlab-org/gitaly/-/merge_requests/3947. Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/343035 Changelog: performance
显示
- Gemfile 1 个添加, 1 个删除Gemfile
- Gemfile.lock 2 个添加, 2 个删除Gemfile.lock
- app/models/integrations/jira.rb 9 个添加, 1 个删除app/models/integrations/jira.rb
- config/feature_flags/development/jira_use_first_ref_by_oid.yml 8 个添加, 0 个删除...g/feature_flags/development/jira_use_first_ref_by_oid.yml
- lib/gitlab/git/commit.rb 13 个添加, 1 个删除lib/gitlab/git/commit.rb
- lib/gitlab/git/repository.rb 11 个添加, 0 个删除lib/gitlab/git/repository.rb
- lib/gitlab/gitaly_client/ref_service.rb 7 个添加, 0 个删除lib/gitlab/gitaly_client/ref_service.rb
- spec/lib/gitlab/git/commit_spec.rb 8 个添加, 0 个删除spec/lib/gitlab/git/commit_spec.rb
- spec/lib/gitlab/git/repository_spec.rb 26 个添加, 0 个删除spec/lib/gitlab/git/repository_spec.rb
- spec/lib/gitlab/gitaly_client/ref_service_spec.rb 15 个添加, 0 个删除spec/lib/gitlab/gitaly_client/ref_service_spec.rb
- spec/models/integrations/jira_spec.rb 15 个添加, 1 个删除spec/models/integrations/jira_spec.rb
加载中
想要评论请 注册 或 登录