diff options
author | Robert Speicher <robert@gitlab.com> | 2017-12-22 17:18:22 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-12-22 17:18:22 +0000 |
commit | 87dbf9846dcc870581ed753c730d768e671c51d4 (patch) | |
tree | c5fbc5bea4912bb1587720c55462702e9e786a58 /lib | |
parent | 77d190b4b4ebd78daa965eb4a2ed4a1e3579d956 (diff) | |
parent | 16b8297e77501134cd93a74c3d5c60712930e7fd (diff) | |
download | gitlab-ce-87dbf9846dcc870581ed753c730d768e671c51d4.tar.gz |
Merge branch 'dm-issue-move-transaction-error' into 'master'
Execute project hooks and services after commit when moving an issue
Closes #41324
See merge request gitlab-org/gitlab-ce!16108
Diffstat (limited to 'lib')
-rw-r--r-- | lib/after_commit_queue.rb | 10 |
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 |