mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
avoid deadlock
This commit is contained in:
parent
03a0936556
commit
3c42814b58
|
@ -368,8 +368,16 @@ func (ms *MasterServer) OnPeerUpdate(update *master_pb.ClusterNodeUpdate, startF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ms.onPeerUpdateLock.RLock()
|
ms.onPeerUpdateLock.RLock()
|
||||||
if len(ms.onPeerUpdateDoneCns) > 0 {
|
isGtZero := len(ms.onPeerUpdateDoneCns) > 0
|
||||||
for _, onPeerUpdateDoneCn := range ms.onPeerUpdateDoneCns {
|
ms.onPeerUpdateLock.RUnlock()
|
||||||
|
if isGtZero {
|
||||||
|
var chanPtrs []*chan string
|
||||||
|
ms.onPeerUpdateLock.RLock()
|
||||||
|
for _, cn := range ms.onPeerUpdateDoneCns {
|
||||||
|
chanPtrs = append(chanPtrs, cn)
|
||||||
|
}
|
||||||
|
ms.onPeerUpdateLock.RUnlock()
|
||||||
|
for _, onPeerUpdateDoneCn := range chanPtrs {
|
||||||
*onPeerUpdateDoneCn <- peerName
|
*onPeerUpdateDoneCn <- peerName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue