From 7875470e74022e2b4262e51a349c4e3c15459a33 Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Wed, 20 Jul 2022 18:40:35 +0500 Subject: [PATCH] onPeerUpdateGoroutineCount use int32 --- weed/server/master_server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/weed/server/master_server.go b/weed/server/master_server.go index 7f9bff389..98fb6aab1 100644 --- a/weed/server/master_server.go +++ b/weed/server/master_server.go @@ -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 {