Commit 18861c42 authored by Subashis's avatar Subashis Committed by Mehmet Emin INAC

Do not update feedback when it is persisted

Previously, we were trying to update the feedback records associated
with the vulnerabilities while dismissing them. This was causing long
update queries as one feedback can be associated with more than one
vulnerabilities while the users were trying to dismiss all those
vulnerability records.

Changelog: fixed
EE: true
parent c17e7fad
...@@ -134,7 +134,9 @@ module VulnerabilityFeedback ...@@ -134,7 +134,9 @@ module VulnerabilityFeedback
dismiss_findings: false).execute dismiss_findings: false).execute
end end
raise ActiveRecord::Rollback unless vulnerability_feedback.save unless vulnerability_feedback.persisted?
raise ActiveRecord::Rollback unless vulnerability_feedback.save
end
end end
end end
......
...@@ -146,6 +146,19 @@ RSpec.describe VulnerabilityFeedback::CreateService, '#execute' do ...@@ -146,6 +146,19 @@ RSpec.describe VulnerabilityFeedback::CreateService, '#execute' do
end end
end end
end end
context 'when we already have persisted feedback' do
let!(:feedback) do
create(:vulnerability_feedback, :dismissal,
project: project,
pipeline: pipeline,
project_fingerprint: project_fingerprint)
end
it 'does not update the feedback' do
expect { result }.not_to change { feedback.reload.updated_at }
end
end
end end
context 'when feedback_type is issue' do context 'when feedback_type is issue' do
......
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