diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /app/workers/purge_dependency_proxy_cache_worker.rb | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) | |
download | gitlab-ce-aee0a117a889461ce8ced6fcf73207fe017f1d99.tar.gz |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'app/workers/purge_dependency_proxy_cache_worker.rb')
-rw-r--r-- | app/workers/purge_dependency_proxy_cache_worker.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/workers/purge_dependency_proxy_cache_worker.rb b/app/workers/purge_dependency_proxy_cache_worker.rb index db43e4adf20..615fa81f28e 100644 --- a/app/workers/purge_dependency_proxy_cache_worker.rb +++ b/app/workers/purge_dependency_proxy_cache_worker.rb @@ -12,14 +12,21 @@ class PurgeDependencyProxyCacheWorker queue_namespace :dependency_proxy feature_category :dependency_proxy + UPDATE_BATCH_SIZE = 100 + def perform(current_user_id, group_id) @current_user = User.find_by_id(current_user_id) @group = Group.find_by_id(group_id) return unless valid? - @group.dependency_proxy_blobs.destroy_all # rubocop:disable Cop/DestroyAll - @group.dependency_proxy_manifests.destroy_all # rubocop:disable Cop/DestroyAll + @group.dependency_proxy_blobs.each_batch(of: UPDATE_BATCH_SIZE) do |batch| + batch.update_all(status: :expired) + end + + @group.dependency_proxy_manifests.each_batch(of: UPDATE_BATCH_SIZE) do |batch| + batch.update_all(status: :expired) + end end private |