Skip to content

Only build MR hook data when needed

Heinrich Lee Yu requested to merge 381729-optimize-triggering-of-mr-hooks into master

What does this MR do and why?

We don't need to build the MR hook data when there are no webhooks configured. This triggers a bunch of queries and made some specs go over the query limit.

This is similar to 3ad10d40

How to set up and validate locally

bin/rspec './spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb[1:1:4:2:3:1:2]'

I also tried manually editing the query limiting threshold so I can see how many queries are being executed now. It's down to 67 from 101.

          Gitlab::QueryLimiting::Transaction::ThresholdExceededError:
            Too many SQL queries were executed in Projects::MergeRequestsController#show: a maximum of 10 is allowed but 67 SQL queries were executed

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #381729 (closed)

Edited by Heinrich Lee Yu

Merge request reports