Skip to content

Commit

Permalink
searcher: make result channel buffered
Browse files Browse the repository at this point in the history
  • Loading branch information
sahildua2305 committed Dec 30, 2017
1 parent e74b892 commit 302e597
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions searcher/searcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,9 @@ func MakeAll(cfg *config.Config) (map[string]*Searcher, map[string]error, error)

lim := makeLimiter(cfg.MaxConcurrentIndexers)

n := len(cfg.Repos)
// Channel to receive the results from newSearcherConcurrent function.
resultCh := make(chan searcherResult)
resultCh := make(chan searcherResult, n)

// Start new searchers for all repos in different go routines while
// respecting cfg.MaxConcurrentIndexers.
Expand All @@ -296,7 +297,6 @@ func MakeAll(cfg *config.Config) (map[string]*Searcher, map[string]error, error)
}

// Collect the results on resultCh channel for all repos.
n := len(cfg.Repos)
for i := 0; i < n; i++ {
r := <-resultCh
if r.err != nil {
Expand Down

0 comments on commit 302e597

Please sign in to comment.