fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

shards: compute shard rank outside of critical section

Change-Id: I899eabf0bfc216329bf9f96a92e9dd1c17521ab3

+6 -2
+6 -2
shards/shards.go
··· 406 406 } 407 407 408 408 func (s *shardedSearcher) replace(key string, shard zoekt.Searcher) { 409 + var rank uint16 410 + if shard != nil { 411 + rank = shardRank(shard) 412 + } 413 + 409 414 s.lock(context.Background()) 410 415 defer s.unlock() 411 416 old := s.shards[key] ··· 416 421 if shard == nil { 417 422 delete(s.shards, key) 418 423 } else { 419 - 420 424 s.shards[key] = rankedShard{ 421 - rank: shardRank(shard), 425 + rank: rank, 422 426 Searcher: shard, 423 427 } 424 428 }