diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-26 18:09:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-26 18:09:18 +0300 |
commit | 2446c39adaea91d1120c9eb0936e93e9314171c1 (patch) | |
tree | 12139c11f94232b2a02b511998a456535e33faed /app/workers | |
parent | c0dd450008c1cee260905e54bbed202891158697 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/all_queues.yml | 8 | ||||
-rw-r--r-- | app/workers/packages/rubygems/extraction_worker.rb | 27 |
2 files changed, 35 insertions, 0 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 3dbb087d8d8..eeae5de2637 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -1107,6 +1107,14 @@ :weight: 1 :idempotent: :tags: [] +- :name: package_repositories:packages_rubygems_extraction + :feature_category: :package_registry + :has_external_dependencies: + :urgency: :low + :resource_boundary: :unknown + :weight: 1 + :idempotent: true + :tags: [] - :name: pipeline_background:archive_trace :feature_category: :continuous_integration :has_external_dependencies: diff --git a/app/workers/packages/rubygems/extraction_worker.rb b/app/workers/packages/rubygems/extraction_worker.rb new file mode 100644 index 00000000000..1e5cd0b54ce --- /dev/null +++ b/app/workers/packages/rubygems/extraction_worker.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Packages + module Rubygems + class ExtractionWorker # rubocop:disable Scalability/IdempotentWorker + include ApplicationWorker + + queue_namespace :package_repositories + feature_category :package_registry + deduplicate :until_executing + + idempotent! + + def perform(package_file_id) + package_file = ::Packages::PackageFile.find_by_id(package_file_id) + + return unless package_file + + ::Packages::Rubygems::ProcessGemService.new(package_file).execute + + rescue ::Packages::Rubygems::ProcessGemService::ExtractionError => e + Gitlab::ErrorTracking.log_exception(e, project_id: package_file.project_id) + package_file.package.destroy! + end + end + end +end |