Commit dc29dc66 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Avoid extra Sidekiq jobs for expiring CI etags

Removes the FF for expiring etag cache synchronously

Changelog: performance
parent a634d02e
...@@ -244,11 +244,7 @@ module Ci ...@@ -244,11 +244,7 @@ module Ci
::JiraConnect::SyncBuildsWorker.perform_async(pipeline.id, seq_id) ::JiraConnect::SyncBuildsWorker.perform_async(pipeline.id, seq_id)
end end
if Feature.enabled?(:expire_job_and_pipeline_cache_synchronously, pipeline.project, default_enabled: :yaml) Ci::ExpirePipelineCacheService.new.execute(pipeline) # rubocop: disable CodeReuse/ServiceClass
Ci::ExpirePipelineCacheService.new.execute(pipeline) # rubocop: disable CodeReuse/ServiceClass
else
ExpirePipelineCacheWorker.perform_async(pipeline.id)
end
end end
end end
......
...@@ -191,11 +191,7 @@ class CommitStatus < Ci::ApplicationRecord ...@@ -191,11 +191,7 @@ class CommitStatus < Ci::ApplicationRecord
commit_status.run_after_commit do commit_status.run_after_commit do
PipelineProcessWorker.perform_async(pipeline_id) unless transition_options[:skip_pipeline_processing] PipelineProcessWorker.perform_async(pipeline_id) unless transition_options[:skip_pipeline_processing]
if Feature.enabled?(:expire_job_and_pipeline_cache_synchronously, project, default_enabled: :yaml) expire_etag_cache!
expire_etag_cache!
else
ExpireJobCacheWorker.perform_async(id)
end
end end
end end
......
...@@ -36,9 +36,7 @@ module Ci ...@@ -36,9 +36,7 @@ module Ci
update_pipeline! update_pipeline!
update_statuses_processed! update_statuses_processed!
if Feature.enabled?(:expire_job_and_pipeline_cache_synchronously, pipeline.project, default_enabled: :yaml) Ci::ExpirePipelineCacheService.new.execute(pipeline)
Ci::ExpirePipelineCacheService.new.execute(pipeline)
end
true true
end end
......
---
name: expire_job_and_pipeline_cache_synchronously
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75611
rollout_issue_url: https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1380
milestone: '14.6'
type: development
group: group::project management
default_enabled: false
...@@ -1517,30 +1517,12 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do ...@@ -1517,30 +1517,12 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
end end
describe 'pipeline caching' do describe 'pipeline caching' do
context 'when expire_job_and_pipeline_cache_synchronously is enabled' do it 'executes Ci::ExpirePipelineCacheService' do
before do expect_next_instance_of(Ci::ExpirePipelineCacheService) do |service|
stub_feature_flags(expire_job_and_pipeline_cache_synchronously: true) expect(service).to receive(:execute).with(pipeline)
end
it 'executes Ci::ExpirePipelineCacheService' do
expect_next_instance_of(Ci::ExpirePipelineCacheService) do |service|
expect(service).to receive(:execute).with(pipeline)
end
pipeline.cancel
end
end
context 'when expire_job_and_pipeline_cache_synchronously is disabled' do
before do
stub_feature_flags(expire_job_and_pipeline_cache_synchronously: false)
end end
it 'performs ExpirePipelinesCacheWorker' do pipeline.cancel
expect(ExpirePipelineCacheWorker).to receive(:perform_async).with(pipeline.id)
pipeline.cancel
end
end end
end end
......
...@@ -46,28 +46,10 @@ RSpec.describe CommitStatus do ...@@ -46,28 +46,10 @@ RSpec.describe CommitStatus do
describe 'status state machine' do describe 'status state machine' do
let!(:commit_status) { create(:commit_status, :running, project: project) } let!(:commit_status) { create(:commit_status, :running, project: project) }
context 'when expire_job_and_pipeline_cache_synchronously is enabled' do it 'invalidates the cache after a transition' do
before do expect(commit_status).to receive(:expire_etag_cache!)
stub_feature_flags(expire_job_and_pipeline_cache_synchronously: true)
end
it 'invalidates the cache after a transition' do
expect(commit_status).to receive(:expire_etag_cache!)
commit_status.success!
end
end
context 'when expire_job_and_pipeline_cache_synchronously is disabled' do commit_status.success!
before do
stub_feature_flags(expire_job_and_pipeline_cache_synchronously: false)
end
it 'invalidates the cache after a transition' do
expect(ExpireJobCacheWorker).to receive(:perform_async).with(commit_status.id)
commit_status.success!
end
end end
describe 'transitioning to running' do describe 'transitioning to running' 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