Commit 08ca2442 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'after_commit_queue_concern_fix' into 'master'

Move AfterCommitQueue to under app/models

See merge request gitlab-org/gitlab!75455
parents aaf32baa 2d86a94f
......@@ -90,7 +90,6 @@ Rails/SaveBang:
- 'spec/controllers/boards/issues_controller_spec.rb'
- 'spec/controllers/sent_notifications_controller_spec.rb'
- 'spec/controllers/sessions_controller_spec.rb'
- 'spec/lib/after_commit_queue_spec.rb'
- 'spec/lib/backup/manager_spec.rb'
- 'spec/lib/gitlab/alerting/alert_spec.rb'
- 'spec/lib/gitlab/analytics/cycle_analytics/records_fetcher_spec.rb'
......@@ -2392,7 +2391,6 @@ Database/MultipleDatabases:
- 'ee/spec/models/pg_replication_slot_spec.rb'
- 'ee/spec/services/ee/merge_requests/update_service_spec.rb'
- 'lib/backup/database.rb'
- 'lib/after_commit_queue.rb'
- 'lib/backup/manager.rb'
- 'lib/gitlab/current_settings.rb'
- 'lib/gitlab/database/load_balancing/load_balancer.rb'
......
......@@ -16,7 +16,7 @@ module AfterCommitQueue
def run_after_commit_or_now(&block)
if ApplicationRecord.inside_transaction?
if ActiveRecord::Base.connection.current_transaction.records&.include?(self)
if ActiveRecord::Base.connection.current_transaction.records&.include?(self) # rubocop: disable Database/MultipleDatabases
run_after_commit(&block)
else
# If the current transaction does not include this record, we can run
......
......@@ -10,7 +10,7 @@ RSpec.describe AfterCommitQueue do
project = build(:project)
project.run_after_commit(&test_proc)
project.save
project.save!
expect(called).to be true
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment