diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-08-22 11:34:52 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-08-22 11:34:52 +0000 |
commit | f3d9e19b02b57a15d9ba34b2bfd8756b3eb8b2bd (patch) | |
tree | c16c6cfc849d392ae8e0ea5d424ea8e68fa04221 | |
parent | 726f5cdc2b6413ad1a538e3b9aea2ad0f2e6344e (diff) | |
parent | 377e3670a9aa2ca1419232d75b060cfccc58c7ef (diff) | |
download | gitlab-ce-f3d9e19b02b57a15d9ba34b2bfd8756b3eb8b2bd.tar.gz |
Merge branch 'sh-conditional-system-hook-push' into 'master'
Eliminate unnecessary and duplicate system hook fires
Closes #50549
See merge request gitlab-org/gitlab-ce!21337
-rw-r--r-- | app/services/git_push_service.rb | 1 | ||||
-rw-r--r-- | changelogs/unreleased/sh-conditional-system-hook-push.yml | 5 | ||||
-rw-r--r-- | spec/services/git_push_service_spec.rb | 10 |
3 files changed, 12 insertions, 4 deletions
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index 637c1df4ad9..156b4b3c6ec 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -140,7 +140,6 @@ class GitPushService < BaseService EventCreateService.new.push(project, current_user, build_push_data) Ci::CreatePipelineService.new(project, current_user, build_push_data).execute(:push) - SystemHookPushWorker.perform_async(build_push_data.dup, :push_hooks) project.execute_hooks(build_push_data.dup, :push_hooks) project.execute_services(build_push_data.dup, :push_hooks) diff --git a/changelogs/unreleased/sh-conditional-system-hook-push.yml b/changelogs/unreleased/sh-conditional-system-hook-push.yml new file mode 100644 index 00000000000..3a1a1b3d36c --- /dev/null +++ b/changelogs/unreleased/sh-conditional-system-hook-push.yml @@ -0,0 +1,5 @@ +--- +title: Eliminate unnecessary and duplicate system hook fires +merge_request: 21337 +author: +type: performance diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb index a3c9a660c2f..ed0088a9500 100644 --- a/spec/services/git_push_service_spec.rb +++ b/spec/services/git_push_service_spec.rb @@ -223,9 +223,13 @@ describe GitPushService, services: true do end end - context "Sends System Push data" do - it "when pushing on a branch" do - expect(SystemHookPushWorker).to receive(:perform_async).with(push_data, :push_hooks) + describe 'system hooks' do + let(:system_hook_service) { double() } + + it "sends a system hook after pushing a branch" do + expect(SystemHooksService).to receive(:new).and_return(system_hook_service) + expect(system_hook_service).to receive(:execute_hooks).with(push_data, :push_hooks) + execute_service(project, user, oldrev, newrev, ref) end end |