Skip to content

Commit

Permalink
initialize agg earlier on to make next commit clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
keegancsmith committed Mar 26, 2024
1 parent f2577c2 commit 4c883fd
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions shards/shards.go
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,20 @@ func (ss *shardedSearcher) List(ctx context.Context, r query.Q, opts *zoekt.List
tr.LazyPrintf("acquired process")

loaded := ss.getLoaded()

// Setup what we return now, since we may short circuit if there are no
// shards to search.
stillLoadingCrashes := 0
if !loaded.ready {
// We may have missed results due to not being fully loaded.
stillLoadingCrashes++
}
agg := zoekt.RepoList{
Crashes: stillLoadingCrashes,
ReposMap: zoekt.ReposMap{},
Repos: []*zoekt.RepoListEntry{},
}

shards := loaded.shards
shardCount := len(shards)
all := make(chan shardListResult, shardCount)
Expand All @@ -938,17 +952,6 @@ func (ss *shardedSearcher) List(ctx context.Context, r query.Q, opts *zoekt.List
}()
}

stillLoadingCrashes := 0
if !loaded.ready {
// We may have missed results due to not being fully loaded.
stillLoadingCrashes++
}

agg := zoekt.RepoList{
Crashes: stillLoadingCrashes,
ReposMap: zoekt.ReposMap{},
}

uniq := map[string]*zoekt.RepoListEntry{}

for range shards {
Expand Down

0 comments on commit 4c883fd

Please sign in to comment.