Browse Source

avoid dead lock

pull/3645/head
chrislu 2 years ago
parent
commit
3cb914f7e1
  1. 2
      weed/topology/data_center.go
  2. 2
      weed/topology/rack.go
  3. 2
      weed/topology/topology.go

2
weed/topology/data_center.go

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

2
weed/topology/rack.go

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

2
weed/topology/topology.go

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

Loading…
Cancel
Save