diff options
Diffstat (limited to 'app/workers/dependency_proxy/cleanup_dependency_proxy_worker.rb')
-rw-r--r-- | app/workers/dependency_proxy/cleanup_dependency_proxy_worker.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/workers/dependency_proxy/cleanup_dependency_proxy_worker.rb b/app/workers/dependency_proxy/cleanup_dependency_proxy_worker.rb new file mode 100644 index 00000000000..d77c782267a --- /dev/null +++ b/app/workers/dependency_proxy/cleanup_dependency_proxy_worker.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module DependencyProxy + class CleanupDependencyProxyWorker + include ApplicationWorker + include CronjobQueue # rubocop:disable Scalability/CronWorkerContext + + data_consistency :always + idempotent! + + feature_category :dependency_proxy + + def perform + enqueue_blob_cleanup_job if DependencyProxy::Blob.expired.any? + enqueue_manifest_cleanup_job if DependencyProxy::Manifest.expired.any? + end + + private + + def enqueue_blob_cleanup_job + DependencyProxy::CleanupBlobWorker.perform_with_capacity + end + + def enqueue_manifest_cleanup_job + DependencyProxy::CleanupManifestWorker.perform_with_capacity + end + end +end |