mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-02-09 09:17:28 +08:00
go fmt
This commit is contained in:
@@ -85,11 +85,11 @@ func (n *NodeImpl) PickNodesByWeight(numberOfNodes int, filterFirstNodeFn func(d
|
||||
|
||||
//pick nodes randomly by weights, the node picked earlier has higher final weights
|
||||
sortedCandidates := make([]Node, 0, len(candidates))
|
||||
for i:=0; i<len(candidates); i++ {
|
||||
for i := 0; i < len(candidates); i++ {
|
||||
weightsInterval := rand.Int63n(totalWeights)
|
||||
lastWeights := int64(0)
|
||||
for k, weights := range candidatesWeights {
|
||||
if (weightsInterval>=lastWeights) && (weightsInterval<lastWeights + weights) {
|
||||
if (weightsInterval >= lastWeights) && (weightsInterval < lastWeights+weights) {
|
||||
sortedCandidates = append(sortedCandidates, candidates[k])
|
||||
candidatesWeights[k] = 0
|
||||
totalWeights -= weights
|
||||
|
||||
@@ -321,7 +321,7 @@ func TestFindEmptySlotsForOneVolumeScheduleByWeight(t *testing.T) {
|
||||
|
||||
distribution := map[NodeId]int{}
|
||||
// assign 1000 volumes
|
||||
for i:=0;i<1000 ;i++ {
|
||||
for i := 0; i < 1000; i++ {
|
||||
servers, err := vg.findEmptySlotsForOneVolume(topo, volumeGrowOption)
|
||||
if err != nil {
|
||||
fmt.Println("finding empty slots error :", err)
|
||||
@@ -339,4 +339,4 @@ func TestFindEmptySlotsForOneVolumeScheduleByWeight(t *testing.T) {
|
||||
for k, v := range distribution {
|
||||
fmt.Printf("%s : %d\n", k, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user