From b4e751557ad35d7c5fbed55328892c43a4c84ba5 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 17 Oct 2016 18:09:43 +0800 Subject: [PATCH] Use run_after_commit to avoid race condition, feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6342/diffs#note_17038749 --- app/models/ci/pipeline.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 0ed1c496022..2a0865abd4b 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -84,7 +84,9 @@ module Ci end after_transition any => [:success, :failed] do |pipeline| - SendPipelineNotificationWorker.perform_async(pipeline.id) + pipeline.run_after_commit do + SendPipelineNotificationWorker.perform_async(pipeline.id) + end end end