diff --git a/ee/app/services/search/zoekt/scheduling_service.rb b/ee/app/services/search/zoekt/scheduling_service.rb index b6629cf9fa6ad7c230a278180060892fbc5cfb93..9823647cfa6b93714bce4ac1210ad9b5a6243f09 100644 --- a/ee/app/services/search/zoekt/scheduling_service.rb +++ b/ee/app/services/search/zoekt/scheduling_service.rb @@ -7,7 +7,6 @@ class SchedulingService CONFIG = { indices_to_evict_check: { - period: 10.minutes, if: -> { Index.pending_eviction.exists? }, dispatch: { event: IndexToEvictEvent } }, @@ -23,7 +22,6 @@ class SchedulingService } }, index_should_be_marked_as_orphaned_check: { - period: 10.minutes, if: -> { Index.should_be_marked_as_orphaned.exists? }, dispatch: { event: OrphanedIndexEvent } }, @@ -32,7 +30,6 @@ class SchedulingService dispatch: { event: IndexMarkPendingEvictionEvent } }, index_to_delete_check: { - period: 10.minutes, if: -> { Index.should_be_deleted.exists? }, dispatch: { event: IndexMarkedAsToDeleteEvent } }, @@ -66,7 +63,6 @@ class SchedulingService dispatch: { event: RepoToIndexEvent } }, repo_to_delete_check: { - period: 10.minutes, if: -> { ::Search::Zoekt::Repository.should_be_deleted.exists? }, dispatch: { event: RepoMarkedAsToDeleteEvent } }, @@ -75,7 +71,6 @@ class SchedulingService dispatch: { event: UpdateIndexUsedStorageBytesEvent } }, update_replica_states: { - period: 2.minutes, execute: -> { ReplicaStateService.execute } }, saas_rollout: { @@ -345,11 +340,9 @@ def auto_index_self_managed return if Gitlab::Saas.feature_available?(:exact_code_search) return unless Gitlab::CurrentSettings.zoekt_auto_index_root_namespace? - execute_every 10.minutes do - Namespace.group_namespaces.root_namespaces_without_zoekt_enabled_namespace.each_batch do |batch| - data = batch.pluck_primary_key.map { |id| { root_namespace_id: id } } - Search::Zoekt::EnabledNamespace.insert_all(data) - end + Namespace.group_namespaces.root_namespaces_without_zoekt_enabled_namespace.each_batch do |batch| + data = batch.pluck_primary_key.map { |id| { root_namespace_id: id } } + Search::Zoekt::EnabledNamespace.insert_all(data) end end diff --git a/ee/spec/services/search/zoekt/scheduling_service_spec.rb b/ee/spec/services/search/zoekt/scheduling_service_spec.rb index 92c6cab553bfb2bf7526404128dcda4a67c68559..7815384a08dd905d323030d8e05e06efa7680d71 100644 --- a/ee/spec/services/search/zoekt/scheduling_service_spec.rb +++ b/ee/spec/services/search/zoekt/scheduling_service_spec.rb @@ -119,7 +119,7 @@ context 'with tasks that have cache periods configured' do it 'is formatted correctly based on task name and cache period' do - %i[lost_nodes_check update_replica_states].each do |task| + %i[lost_nodes_check].each do |task| svc = described_class.new(task) expect(svc.cache_key).to eq("search/zoekt/scheduling_service:execute_every:#{svc.cache_period}:#{task}") end @@ -130,7 +130,7 @@ describe '#cache_period' do context 'with a task from CONFIG' do it 'returns the period when configured' do - expect(described_class.new(:update_replica_states).cache_period).to eq(2.minutes) + expect(described_class.new(:lost_nodes_check).cache_period).to eq(10.minutes) end it 'returns nil when not configured' do