diff options
Diffstat (limited to 'app/workers/container_registry')
-rw-r--r-- | app/workers/container_registry/cleanup_worker.rb | 17 | ||||
-rw-r--r-- | app/workers/container_registry/record_data_repair_detail_worker.rb | 6 |
2 files changed, 4 insertions, 19 deletions
diff --git a/app/workers/container_registry/cleanup_worker.rb b/app/workers/container_registry/cleanup_worker.rb index 448a16ad309..9ec02dd613e 100644 --- a/app/workers/container_registry/cleanup_worker.rb +++ b/app/workers/container_registry/cleanup_worker.rb @@ -16,8 +16,6 @@ module ContainerRegistry BATCH_SIZE = 200 def perform - log_counts - reset_stale_deletes delete_stale_ongoing_repair_details @@ -54,26 +52,13 @@ module ContainerRegistry end def should_enqueue_record_detail_jobs? - return false unless Gitlab.com? + return false unless Gitlab.com_except_jh? return false unless Feature.enabled?(:registry_data_repair_worker) return false unless ContainerRegistry::GitlabApiClient.supports_gitlab_api? Project.pending_data_repair_analysis.exists? end - def log_counts - ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries do - log_extra_metadata_on_done( - :delete_scheduled_container_repositories_count, - ContainerRepository.delete_scheduled.count - ) - log_extra_metadata_on_done( - :stale_delete_container_repositories_count, - stale_delete_container_repositories.count - ) - end - end - def stale_delete_container_repositories ContainerRepository.delete_ongoing.with_stale_delete_at(STALE_DELETE_THRESHOLD.ago) end diff --git a/app/workers/container_registry/record_data_repair_detail_worker.rb b/app/workers/container_registry/record_data_repair_detail_worker.rb index 390481f8e01..3e40dbbb99a 100644 --- a/app/workers/container_registry/record_data_repair_detail_worker.rb +++ b/app/workers/container_registry/record_data_repair_detail_worker.rb @@ -17,7 +17,7 @@ module ContainerRegistry LEASE_TIMEOUT = 1.hour.to_i def perform_work - return unless Gitlab.com? + return unless Gitlab.com_except_jh? return unless next_project return if next_project.container_registry_data_repair_detail @@ -51,7 +51,7 @@ module ContainerRegistry end def remaining_work_count - return 0 unless Gitlab.com? + return 0 unless Gitlab.com_except_jh? return 0 unless Feature.enabled?(:registry_data_repair_worker) return 0 unless ContainerRegistry::GitlabApiClient.supports_gitlab_api? @@ -69,7 +69,7 @@ module ContainerRegistry end def next_project - Project.pending_data_repair_analysis.first + Project.pending_data_repair_analysis.limit(max_running_jobs * 2).sample end strong_memoize_attr :next_project |