Commit ca05efee authored by Steve Abrams's avatar Steve Abrams

Disable unused package callback

Wrap  #update_composer_cache from the package model
in a feature flag to safely disable and then remove it.
It is a broken callback that is part of an incomplete
abandoned feature.
parent da3077ac
...@@ -158,7 +158,7 @@ class Packages::Package < ApplicationRecord ...@@ -158,7 +158,7 @@ class Packages::Package < ApplicationRecord
joins(:project).reorder(keyset_order) joins(:project).reorder(keyset_order)
end end
after_commit :update_composer_cache, on: :destroy, if: -> { composer? } after_commit :update_composer_cache, on: :destroy, if: -> { composer? && Feature.disabled?(:disable_composer_callback) }
def self.only_maven_packages_with_path(path, use_cte: false) def self.only_maven_packages_with_path(path, use_cte: false)
if use_cte if use_cte
......
---
name: disable_composer_callback
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64016
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/333587
milestone: '14.0'
type: development
group: group::package
default_enabled: false
...@@ -1019,10 +1019,24 @@ RSpec.describe Packages::Package, type: :model do ...@@ -1019,10 +1019,24 @@ RSpec.describe Packages::Package, type: :model do
package.composer_metadatum.reload package.composer_metadatum.reload
end end
it 'schedule the update job' do context 'with feature flag disabled' do
expect(::Packages::Composer::CacheUpdateWorker).to receive(:perform_async).with(project.id, package_name, package.composer_metadatum.version_cache_sha) before do
stub_feature_flags(disable_composer_callback: false)
end
it 'schedule the update job' do
expect(::Packages::Composer::CacheUpdateWorker).to receive(:perform_async).with(project.id, package_name, package.composer_metadatum.version_cache_sha)
package.destroy!
end
end
package.destroy! context 'with feature flag enabled' do
it 'does nothing' do
expect(::Packages::Composer::CacheUpdateWorker).not_to receive(:perform_async)
package.destroy!
end
end end
end end
end 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