Skip to content

Commit

Permalink
server/cluster: address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
huachaohuang committed Oct 31, 2016
1 parent 761bfc0 commit 64c23c2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ func (c *RaftCluster) cacheAllRegions() error {
nextID := uint64(0)
endRegionKey := makeRegionKey(c.clusterRoot, math.MaxUint64)

c.cachedCluster.regions.Lock()
defer c.cachedCluster.regions.Unlock()

for {
key := makeRegionKey(c.clusterRoot, nextID)
resp, err := kvGet(c.s.client, key, clientv3.WithRange(endRegionKey))
Expand All @@ -341,7 +344,7 @@ func (c *RaftCluster) cacheAllRegions() error {
}
}

log.Infof("cache all %d regions cost %s", c.cachedCluster.getRegionCount(), time.Now().Sub(start))
log.Infof("cache all %d regions cost %s", len(c.cachedCluster.regions.regions), time.Now().Sub(start))
return nil
}

Expand Down

0 comments on commit 64c23c2

Please sign in to comment.