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

View File

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