mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Do not replace the cache entry if there is already one
* That way, multiple lookups for the same file always return the same object.
50a431b6db
This commit is contained in:
parent
2453d16f5e
commit
05ae2c11fa
1 changed files with 6 additions and 1 deletions
|
@ -1124,8 +1124,13 @@ class Gem::Specification < Gem::BasicSpecification
|
||||||
if Gem::Specification === _spec
|
if Gem::Specification === _spec
|
||||||
_spec.loaded_from = File.expand_path file.to_s
|
_spec.loaded_from = File.expand_path file.to_s
|
||||||
LOAD_CACHE_MUTEX.synchronize do
|
LOAD_CACHE_MUTEX.synchronize do
|
||||||
|
prev = LOAD_CACHE[file]
|
||||||
|
if prev
|
||||||
|
_spec = prev
|
||||||
|
else
|
||||||
LOAD_CACHE[file] = _spec
|
LOAD_CACHE[file] = _spec
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return _spec
|
return _spec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue