mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 21:49:06 +02:00
[rubygems/rubygems] Fix gem install does-not-exist
being super slow
Every time a gem is not found in the Compact Index API, RubyGems will
fallback to the full index, which is very slow. This is unnecessary
because both indexes should be providing the same gems, so if a gem
can't be found in the Compact Index API, it won't be found in the full
index.
We _do_ want a fallback to the full index, whenever the Compact Index
API is not implemented. To detect that, we check that the API responds
to the "/versions" endpoint, just like Bundler does.
Before:
```
$ time gem install fooasdsfafs
ERROR: Could not find a valid gem 'fooasdsfafs' (>= 0) in any repository
gem 20,77s user 0,59s system 96% cpu 22,017 total
```
After:
```
$ time gem install fooasdsfafs
ERROR: Could not find a valid gem 'fooasdsfafs' (>= 0) in any repository
gem 5,02s user 0,09s system 91% cpu 5,568 total
```
c0d6b9eea7
This commit is contained in:
parent
2a17b4f022
commit
fe1bace43c
5 changed files with 10 additions and 112 deletions
|
@ -79,7 +79,7 @@ class Gem::Source
|
|||
uri
|
||||
end
|
||||
|
||||
bundler_api_uri = enforce_trailing_slash(fetch_uri)
|
||||
bundler_api_uri = enforce_trailing_slash(fetch_uri) + "./versions"
|
||||
|
||||
begin
|
||||
fetcher = Gem::RemoteFetcher.fetcher
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue