diff --git a/packages/commands/install/install.cr b/packages/commands/install/install.cr index ce5a8cc..f03f76c 100644 --- a/packages/commands/install/install.cr +++ b/packages/commands/install/install.cr @@ -26,7 +26,7 @@ module Commands::Install *, reporter : Reporter? = nil, store : ::Store? = nil, - raise_on_failure : Bool = false + raise_on_failure : Bool = false, ) state = uninitialized State reporter ||= config.silent ? Reporter::Null.new : Reporter::Interactive.new @@ -164,7 +164,7 @@ module Commands::Install inferred_context : Core::Config::InferredContext, install_config : Install::Config, lockfile : Data::Lockfile, - workspaces : Workspaces? + workspaces : Workspaces?, ) unless config.silent workers_info = begin @@ -206,7 +206,7 @@ module Commands::Install install_config : Install::Config, lockfile : Data::Lockfile, context : Core::Config::InferredContext, - reporter : Reporter + reporter : Reporter, ) : Core::Config if !config.global && lockfile.strategy && lockfile.strategy != install_config.strategy Log.debug { "Install strategy changed from #{lockfile.strategy} to #{install_config.strategy}" if lockfile.strategy } @@ -290,6 +290,7 @@ module Commands::Install end private def self.resolve_dependencies(state : State) + state.pipeline.set_concurrency(state.config.network_concurrency * 3) state.reporter.report_resolver_updates do # Resolve overrides Log.debug { "• Resolving overrides" } diff --git a/packages/commands/install/protocol/registry/resolver.cr b/packages/commands/install/protocol/registry/resolver.cr index 1100353..e52adfb 100644 --- a/packages/commands/install/protocol/registry/resolver.cr +++ b/packages/commands/install/protocol/registry/resolver.cr @@ -23,7 +23,7 @@ struct Commands::Install::Protocol::Registry::Resolver < Commands::Install::Prot specifier = "latest", parent = nil, dependency_type = nil, - skip_cache = false + skip_cache = false, ) super @@ -73,7 +73,7 @@ struct Commands::Install::Protocol::Registry::Resolver < Commands::Install::Prot shasum = dist.shasum version = metadata.version unsupported_algorithm = false - algorithm, hash, algorithm_instance = nil, nil, nil + algorithm, hash = nil, nil if integrity algorithm, hash = integrity.split("-") @@ -81,17 +81,18 @@ struct Commands::Install::Protocol::Registry::Resolver < Commands::Install::Prot unsupported_algorithm = true end - algorithm_instance = case algorithm - when "sha1" - Digest::SHA1.new - when "sha256" - Digest::SHA256.new - when "sha512" - Digest::SHA512.new - else - unsupported_algorithm = true - Digest::SHA1.new - end + algorithm_instance = + case algorithm + when "sha1" + -> { Digest::SHA1.new } + when "sha256" + -> { Digest::SHA256.new } + when "sha512" + -> { Digest::SHA512.new } + else + unsupported_algorithm = true + -> { Digest::SHA1.new } + end # the tarball_url is absolute and can point to an entirely different domain # so we need to find the right client pool for it @@ -103,7 +104,7 @@ struct Commands::Install::Protocol::Registry::Resolver < Commands::Install::Prot client.get("/" + relative_url) do |response| raise "Invalid status code from #{tarball_url} (#{response.status_code})" unless response.status_code == 200 - IO::Digest.new(response.body_io, algorithm_instance).tap do |io| + IO::Digest.new(response.body_io, algorithm_instance.call).tap do |io| state.store.unpack_and_store_tarball(metadata, io) io.skip_to_end diff --git a/packages/core/config.cr b/packages/core/config.cr index 194f566..18dae76 100644 --- a/packages/core/config.cr +++ b/packages/core/config.cr @@ -56,7 +56,7 @@ struct Core::Config {% end %} ) @[Env] - getter network_concurrency : Int32 = 50 + getter network_concurrency : Int32 = 15 @[Env] getter lockfile_format : Data::Lockfile::Format? = nil diff --git a/packages/workspaces/workspaces.cr b/packages/workspaces/workspaces.cr index 13657a2..09473e6 100644 --- a/packages/workspaces/workspaces.cr +++ b/packages/workspaces/workspaces.cr @@ -46,7 +46,7 @@ class Workspaces workspaces_field = workspaces_field["packages"] end - return if workspaces_field.nil? + return if workspaces_field.nil? || workspaces_field.empty? ################# # Gitignore rules from: https://git-scm.com/docs/gitignore