Skip to content

Reduce SQL queries when no pipeline hooks are active

Stan Hu requested to merge sh-avoid-build-hooks-data into master

If no pipeline hooks are active for a project, we still go through the trouble of generating the hook data, which may make a number of SQL, Gitaly, and Redis calls unnecessarily.

Most projects don't have any hooks, so we can reduce the amount of load by only building the hook data if there are active hooks or services. This requires several cheap SQL queries. Note that the optimal way would be to lazily load the hook data, but that requires more complex changes.

This is a similar optimization that was implemented for PostReceive (gitlab-foss!31741 (merged)).

Relates to https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/12055

Edited by Stan Hu

Merge request reports