Merge "pkg/search: lock index for corpus creation"

This commit is contained in:
Mathieu Lonjaret 2016-08-24 21:11:18 +00:00 committed by Gerrit Code Review
commit 7ef7c34a7c
1 changed files with 3 additions and 0 deletions

View File

@ -146,11 +146,14 @@ func newHandlerFromConfig(ld blobserver.Loader, conf jsonconfig.Obj) (http.Handl
h := NewHandler(indexer, ownerBlobRef)
if slurpToMemory {
ii := indexer.(*index.Index)
ii.Lock()
corpus, err := ii.KeepInMemory()
if err != nil {
ii.Unlock()
return nil, fmt.Errorf("error slurping index to memory: %v", err)
}
h.corpus = corpus
ii.Unlock()
}
return h, nil
}