avoid dead lock

This commit is contained in:
chrislu 2022-09-10 11:26:19 -07:00
parent ebef579ebb
commit 3cb914f7e1
3 changed files with 3 additions and 3 deletions

View file

@ -29,7 +29,7 @@ func (dc *DataCenter) GetOrCreateRack(rackName string) *Rack {
}
}
rack := NewRack(rackName)
dc.LinkChildNode(rack)
dc.doLinkChildNode(rack)
return rack
}

View file

@ -47,7 +47,7 @@ func (r *Rack) GetOrCreateDataNode(ip string, port int, grpcPort int, publicUrl
dn.GrpcPort = grpcPort
dn.PublicUrl = publicUrl
dn.LastSeen = time.Now().Unix()
r.LinkChildNode(dn)
r.doLinkChildNode(dn)
for diskType, maxVolumeCount := range maxVolumeCounts {
disk := NewDisk(diskType)
disk.diskUsages.getOrCreateDisk(types.ToDiskType(diskType)).maxVolumeCount = int64(maxVolumeCount)

View file

@ -267,7 +267,7 @@ func (t *Topology) GetOrCreateDataCenter(dcName string) *DataCenter {
}
}
dc := NewDataCenter(dcName)
t.LinkChildNode(dc)
t.doLinkChildNode(dc)
return dc
}