Eliminate unnecessary and duplicate system hook fires

Stan Hu requested to merge sh-conditional-system-hook-push into master

Previously SystemHookPushWorker would always be called after a push event, and this would queue a Sidekiq job regardless of whether any system hooks needed that event. Moreover, another call inside Project#execute_hooks would also fire system hooks if they existed.

This change removes the duplicate system hook calls. For installations without system hooks for push events, this change also can save significant amount of RAM used by Redis.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/50549

Edited by Stan Hu

Merge request reports