pkg/search: RLock index around GetBlobMeta

Because GetBlobMeta is a corpus read, we need to RLock around it.

Context: issue #750

Change-Id: I5b1e33d05b04aaecb0ad49f3af2d46d14b04dbfb
This commit is contained in:
mpl 2016-05-03 15:49:50 +02:00
parent 0ddc0d7ef4
commit d2818d5079
1 changed files with 2 additions and 0 deletions

View File

@ -95,10 +95,12 @@ func (sh *Handler) subscribeToNewBlobs() {
go func() {
ctx := context.Background()
for br := range ch {
sh.index.RLock()
bm, err := sh.index.GetBlobMeta(ctx, br)
if err == nil {
sh.wsHub.newBlobRecv <- bm.CamliType
}
sh.index.RUnlock()
}
}()
}