blob: 1d47ef879624e5c0eb2bd8e4318bf62d967d4280 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# frozen_string_literal: true
module Packages
module Composer
class CacheCleanupWorker
include ApplicationWorker
sidekiq_options retry: 3
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
feature_category :package_registry
tags :exclude_from_kubernetes
idempotent!
def perform
::Packages::Composer::CacheFile.without_namespace.find_in_batches do |cache_files|
cache_files.each(&:destroy)
rescue ActiveRecord::RecordNotFound
# ignore. likely due to object already being deleted.
end
::Packages::Composer::CacheFile.expired.find_in_batches do |cache_files|
cache_files.each(&:destroy)
rescue ActiveRecord::RecordNotFound
# ignore. likely due to object already being deleted.
end
rescue StandardError => e
Gitlab::ErrorTracking.log_exception(e)
end
end
end
end
|