index: cap reindex parallelism

Change-Id: Iaf8a54a547e7d74f9b3702901180b2253aef58aa
This commit is contained in:
Brad Fitzpatrick 2013-02-07 21:02:42 -08:00
parent 78ccdc24e9
commit 14239a5c23
1 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import (
"io/ioutil"
"log"
"strings"
"sync"
"camlistore.org/pkg/blobref"
"camlistore.org/pkg/blobserver"
@ -42,7 +43,14 @@ func (ix *Index) GetBlobHub() blobserver.BlobHub {
return ix.SimpleBlobHubPartitionMap.GetBlobHub()
}
var reindexMu sync.Mutex
func (ix *Index) reindex(br *blobref.BlobRef) {
// TODO: cap how many of these can be going at once, probably more than 1,
// and be more efficient than just blocking goroutines. For now, this:
reindexMu.Lock()
defer reindexMu.Unlock()
bs := ix.BlobSource
if bs == nil {
log.Printf("index: can't re-index %v: no BlobSource", br)