From d2818d507933aaee0652f6ae0035b54a9956ea20 Mon Sep 17 00:00:00 2001 From: mpl Date: Tue, 3 May 2016 15:49:50 +0200 Subject: [PATCH] pkg/search: RLock index around GetBlobMeta Because GetBlobMeta is a corpus read, we need to RLock around it. Context: issue #750 Change-Id: I5b1e33d05b04aaecb0ad49f3af2d46d14b04dbfb --- pkg/search/handler.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/search/handler.go b/pkg/search/handler.go index 9beead2b9..7102f56e4 100644 --- a/pkg/search/handler.go +++ b/pkg/search/handler.go @@ -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() } }() }