search: remove thread-unsafe Hash cache.

Doesn't appear to affect the speed of `brew search`.

Fixes #415.
This commit is contained in:
Mike McQuaid 2016-08-12 21:29:49 +01:00
parent b3ea5c2595
commit b9efa6336e

View File

@ -126,7 +126,7 @@ module Homebrew
return []
end
@@remote_tap_formulae ||= Hash.new do |cache, key|
remote_tap_formulae = Hash.new do |cache, key|
user, repo = key.split("/", 2)
tree = {}
@ -148,7 +148,7 @@ module Homebrew
cache[key] = paths.map { |path| File.basename(path, ".rb") }
end
names = @@remote_tap_formulae["#{user}/#{repo}"]
names = remote_tap_formulae["#{user}/#{repo}"]
user = user.downcase if user == "Homebrew" # special handling for the Homebrew organization
names.select { |name| rx === name }.map { |name| "#{user}/#{repo}/#{name}" }
rescue GitHub::HTTPNotFoundError => e