diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-11 09:10:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-11 09:10:11 +0300 |
commit | 0852a74a60390025793a4d688826d18016612e1e (patch) | |
tree | e559b434b2d80d214e39fd16bc5394de75881394 /app/services/packages | |
parent | cf127374b5f72c00426acad9f2432064eeb1f1e3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/packages')
-rw-r--r-- | app/services/packages/npm/generate_metadata_service.rb | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/app/services/packages/npm/generate_metadata_service.rb b/app/services/packages/npm/generate_metadata_service.rb index c84c170b234..e1795079513 100644 --- a/app/services/packages/npm/generate_metadata_service.rb +++ b/app/services/packages/npm/generate_metadata_service.rb @@ -13,7 +13,6 @@ module Packages def initialize(name, packages) @name = name @packages = packages - @dependencies_cache = {} end def execute(only_dist_tags: false) @@ -22,7 +21,7 @@ module Packages private - attr_reader :name, :packages, :dependencies_cache + attr_reader :name, :packages def metadata(only_dist_tags) result = { dist_tags: dist_tags } @@ -39,17 +38,9 @@ module Packages package_versions = {} packages.each_batch do |relation| - batched_packages = if Feature.enabled?(:npm_optimize_metadata_generation) - fill_dependencies_cache(relation) - - relation.including_dependency_links - .preload_files - .preload_npm_metadatum - else - relation.including_dependency_links_with_dependencies - .preload_files - .preload_npm_metadatum - end + batched_packages = relation.including_dependency_links + .preload_files + .preload_npm_metadatum batched_packages.each do |package| package_file = package.installable_package_files.last @@ -94,12 +85,7 @@ module Packages dependencies = Hash.new { |h, key| h[key] = {} } package.dependency_links.each do |dependency_link| - dependency = if Feature.enabled?(:npm_optimize_metadata_generation) - dependencies_cache[dependency_link.dependency_id] - else - dependency_link.dependency - end - + dependency = dependency_link.dependency dependencies[dependency_link.dependency_type][dependency.name] = dependency.version_pattern end @@ -120,17 +106,6 @@ module Packages json = package.npm_metadatum&.package_json || {} json.slice(*PACKAGE_JSON_ALLOWED_FIELDS) end - - def fill_dependencies_cache(packages) - Packages::Dependency - .with_packages(packages) - .id_not_in(dependencies_cache.keys) - .each_batch do |dependencies| - dependencies.each do |dependency| - dependencies_cache[dependency.id] = dependency - end - end - end end end end |