summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-10-17 18:09:43 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-10-17 18:09:53 +0800
commitb4e751557ad35d7c5fbed55328892c43a4c84ba5 (patch)
tree8d7f5fdd1558a66194205dc1a1672640dccd7838
parent98217bc0674253f30dea3892a8e833436b89d5b9 (diff)
downloadgitlab-ce-b4e751557ad35d7c5fbed55328892c43a4c84ba5.tar.gz
Use run_after_commit to avoid race condition, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6342/diffs#note_17038749
-rw-r--r--app/models/ci/pipeline.rb4
1 files changed, 3 insertions, 1 deletions
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