summaryrefslogtreecommitdiff
path: root/lib/after_commit_queue.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-12-22 11:38:35 +0100
committerDouwe Maan <douwe@selenight.nl>2017-12-22 17:19:50 +0100
commit16b8297e77501134cd93a74c3d5c60712930e7fd (patch)
tree8373c955431ee30156423626a561ca2cf599e47c /lib/after_commit_queue.rb
parent92e15071c13f65cf7250315f1a138284880b0074 (diff)
downloadgitlab-ce-16b8297e77501134cd93a74c3d5c60712930e7fd.tar.gz
Execute project hooks and services after commit when moving an issuedm-issue-move-transaction-error
Diffstat (limited to 'lib/after_commit_queue.rb')
-rw-r--r--lib/after_commit_queue.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/after_commit_queue.rb b/lib/after_commit_queue.rb
index db63c5038ae..a4d8507960e 100644
--- a/lib/after_commit_queue.rb
+++ b/lib/after_commit_queue.rb
@@ -14,7 +14,15 @@ module AfterCommitQueue
def run_after_commit_or_now(&block)
if AfterCommitQueue.inside_transaction?
- run_after_commit(&block)
+ if ActiveRecord::Base.connection.current_transaction.records.include?(self)
+ run_after_commit(&block)
+ else
+ # If the current transaction does not include this record, we can run
+ # the block now, even if it queues a Sidekiq job.
+ Sidekiq::Worker.skipping_transaction_check do
+ instance_eval(&block)
+ end
+ end
else
instance_eval(&block)
end