From ca8382b1fc309dde8d0b4674d34950932458f8e3 Mon Sep 17 00:00:00 2001 From: Gregorius Marco Date: Wed, 1 Oct 2025 13:51:10 +0800 Subject: [PATCH] Remove `touch` on project association in Release model As described in https://gitlab.com/gitlab-com/gl-infra/production-engineering/-/issues/26700#note_2701215780, bulk import saves release evidence which ends up touching the associated project row. When a lot of release instance is saved, the project table would be under a heavy concurrent updates to bump its `updated_at` timestamp. During this period, the `CreateEvidenceWorker` would saturate the pgbouncer connection pool, which also starve other workers and slowing down the entire sidekiq shard. --- app/models/release.rb | 2 +- spec/models/release_spec.rb | 2 +- spec/requests/api/tags_spec.rb | 8 -------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/app/models/release.rb b/app/models/release.rb index 8efc34fa28c8dd..6271d25a1662b2 100644 --- a/app/models/release.rb +++ b/app/models/release.rb @@ -11,7 +11,7 @@ class Release < ApplicationRecord cache_markdown_field :description - belongs_to :project, touch: true + belongs_to :project belongs_to :author, class_name: 'User' has_many :links, class_name: 'Releases::Link' diff --git a/spec/models/release_spec.rb b/spec/models/release_spec.rb index 49c2d4f3c7984f..38350e12aa2133 100644 --- a/spec/models/release_spec.rb +++ b/spec/models/release_spec.rb @@ -11,7 +11,7 @@ it { expect(release).to be_valid } describe 'associations' do - it { is_expected.to belong_to(:project).touch(true) } + it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:author).class_name('User') } it { is_expected.to have_many(:links).class_name('Releases::Link') } it { is_expected.to have_many(:milestones) } diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb index 403416ff6c1dc4..673ed6bd1b2b3f 100644 --- a/spec/requests/api/tags_spec.rb +++ b/spec/requests/api/tags_spec.rb @@ -265,14 +265,6 @@ it_behaves_like "cache expired" end - context "when release is changed" do - before do - create(:release, :legacy, project: project, tag: tag_name) - end - - it_behaves_like "cache expired" - end - context "when project is changed" do before do project.touch -- GitLab