mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
onPeerUpdateGoroutineCount use int32
This commit is contained in:
parent
c5189c343b
commit
7875470e74
|
@ -67,7 +67,7 @@ type MasterServer struct {
|
|||
boundedLeaderChan chan int
|
||||
|
||||
onPeerUpdateDoneCn chan string
|
||||
onPeerUpdateGoroutineCount uint32
|
||||
onPeerUpdateGoroutineCount int32
|
||||
|
||||
// notifying clients
|
||||
clientChansLock sync.RWMutex
|
||||
|
@ -367,16 +367,16 @@ func (ms *MasterServer) OnPeerUpdate(update *master_pb.ClusterNodeUpdate, startF
|
|||
hashicorpRaft.ServerAddress(peerAddress.ToGrpcAddress()), 0, 0)
|
||||
}
|
||||
}
|
||||
if atomic.LoadUint32(&ms.onPeerUpdateGoroutineCount) > 0 {
|
||||
if atomic.LoadInt32(&ms.onPeerUpdateGoroutineCount) > 0 {
|
||||
ms.onPeerUpdateDoneCn <- peerName
|
||||
}
|
||||
} else if isLeader {
|
||||
go func(peerName string) {
|
||||
raftServerRemovalTimeAfter := time.After(RaftServerRemovalTime)
|
||||
raftServerPingTicker := time.NewTicker(5 * time.Minute)
|
||||
atomic.AddUint32(&ms.onPeerUpdateGoroutineCount, 1)
|
||||
atomic.AddInt32(&ms.onPeerUpdateGoroutineCount, 1)
|
||||
defer func() {
|
||||
atomic.AddUint32(&ms.onPeerUpdateGoroutineCount, -1)
|
||||
atomic.AddInt32(&ms.onPeerUpdateGoroutineCount, -1)
|
||||
}()
|
||||
for {
|
||||
select {
|
||||
|
|
Loading…
Reference in a new issue