Commit 82ce5be4 authored by Yorick Peterse's avatar Yorick Peterse

Use after_commit in Vulnerabilities::Feedback

after_save/after_destroy perform their work in the same transaction as
the change to the model, resulting in a cross-database transaction. By
using after_commit we can prevent this from happening as it uses a
separate transaction.

This fixes https://gitlab.com/gitlab-org/gitlab/-/issues/345667.

Changelog: changed
parent b7027ef8
......@@ -38,8 +38,7 @@ module Vulnerabilities
preload(:author, :comment_author, :project, :issue, :merge_request, :pipeline)
end
after_save :touch_pipeline, if: :for_dismissal?
after_destroy :touch_pipeline, if: :for_dismissal?
after_commit :touch_pipeline, if: :for_dismissal?, on: [:create, :update, :destroy]
def self.find_or_init_for(feedback_params)
validate_enums(feedback_params)
......
......@@ -25,7 +25,6 @@
- "./ee/spec/services/ee/users/destroy_service_spec.rb"
- "./ee/spec/services/projects/transfer_service_spec.rb"
- "./ee/spec/services/security/security_orchestration_policies/rule_schedule_service_spec.rb"
- "./ee/spec/services/vulnerability_feedback/create_service_spec.rb"
- "./spec/controllers/abuse_reports_controller_spec.rb"
- "./spec/controllers/admin/spam_logs_controller_spec.rb"
- "./spec/controllers/admin/users_controller_spec.rb"
......
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