Commit b87f79af authored by Doug Stull's avatar Doug Stull

Merge branch '348415-fj-enable-linera-root-update-mirrors-worker' into 'master'

Enable linear roots in UpdateAllMirrorsWorker

See merge request gitlab-org/gitlab!77854
parents 8182672f de22b4ed
---
name: linear_mirrors_worker_roots
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/76735
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/348415
milestone: '14.7'
type: development
group: group::authentication and authorization
default_enabled: false
...@@ -146,16 +146,11 @@ class UpdateAllMirrorsWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -146,16 +146,11 @@ class UpdateAllMirrorsWorker # rubocop:disable Scalability/IdempotentWorker
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def root_namespaces_sql def root_namespaces_sql
namespace = Namespace.where('id = projects.namespace_id') Namespace
.where('id = projects.namespace_id')
if Feature.enabled?(:linear_mirrors_worker_roots, default_enabled: :yaml)
namespace.roots.as_ids
else
Gitlab::ObjectHierarchy
.new(namespace)
.roots .roots
.select(:id) .as_ids
end.to_sql .to_sql
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
...@@ -254,7 +254,6 @@ RSpec.describe UpdateAllMirrorsWorker do ...@@ -254,7 +254,6 @@ RSpec.describe UpdateAllMirrorsWorker do
let(:unlicensed_projects) { [unlicensed_project1, unlicensed_project2, unlicensed_project3, unlicensed_project4] } let(:unlicensed_projects) { [unlicensed_project1, unlicensed_project2, unlicensed_project3, unlicensed_project4] }
context 'when using SQL to filter projects' do context 'when using SQL to filter projects' do
shared_examples 'examples checking namespace plans' do
before do before do
allow(subject).to receive(:check_mirror_plans_in_query?).and_return(true) allow(subject).to receive(:check_mirror_plans_in_query?).and_return(true)
end end
...@@ -280,17 +279,6 @@ RSpec.describe UpdateAllMirrorsWorker do ...@@ -280,17 +279,6 @@ RSpec.describe UpdateAllMirrorsWorker do
end end
end end
it_behaves_like 'examples checking namespace plans'
context 'when feature flag ' do
before do
stub_feature_flags(linear_mirrors_worker_roots: false)
end
it_behaves_like 'examples checking namespace plans'
end
end
context 'when checking licenses on each record individually' do context 'when checking licenses on each record individually' do
before do before do
allow(subject).to receive(:check_mirror_plans_in_query?).and_return(false) allow(subject).to receive(:check_mirror_plans_in_query?).and_return(false)
......
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