• Stan Hu's avatar
    Optimize JIRA ref lookup · 1993feb5
    Stan Hu authored
    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
    1993feb5
commit_spec.rb 22.7 KB