diff options
| author | hazz | 2012-08-08 22:25:04 +0100 |
|---|---|---|
| committer | Max Howell | 2012-08-09 11:58:58 -0400 |
| commit | 60bdb16a7c19b1dc6532ad5606b0abcdab996d9c (patch) | |
| tree | a536893c4e8874c9c469490b61c2edf7e6173049 /Library/Homebrew/cmd | |
| parent | f9751d63c49c9ad1d6ade8978a656060b619a4c2 (diff) | |
| download | brew-60bdb16a7c19b1dc6532ad5606b0abcdab996d9c.tar.bz2 | |
Run each search_tap in a separate thread to speed things up.
Closes Homebrew/homebrew#14066.
Signed-off-by: Max Howell <mxcl@me.com>
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/search.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 1b59e2d72..4f2481db9 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -31,12 +31,19 @@ module Homebrew extend self if query $found = search_results.length - # TODO parallelize! - puts_columns search_tap "josegonzalez", "php", rx - puts_columns search_tap "Homebrew", "versions", rx - puts_columns search_tap "Homebrew", "dupes", rx - puts_columns search_tap "Homebrew", "games", rx - puts_columns search_tap "Homebrew", "science", rx + threads = [] + results = [] + threads << Thread.new { search_tap "josegonzalez", "php", rx } + threads << Thread.new { search_tap "Homebrew", "versions", rx } + threads << Thread.new { search_tap "Homebrew", "dupes", rx } + threads << Thread.new { search_tap "Homebrew", "games", rx } + threads << Thread.new { search_tap "Homebrew", "science", rx } + + threads.each do |t| + results << t.value + end + + results.each { |r| puts_columns r } if $found == 0 and not blacklisted? query puts "No formula found for \"#{query}\". Searching open pull requests..." |
