mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-08-24 21:29:04 +08:00
read existing broker stats
This commit is contained in:
parent
1492bf7552
commit
dff2ce5d2f
@ -20,11 +20,15 @@ func (broker *MessageQueueBroker) ConnectToBalancer(stream mq_pb.SeaweedMessagin
|
|||||||
|
|
||||||
// process init message
|
// process init message
|
||||||
initMessage := req.GetInit()
|
initMessage := req.GetInit()
|
||||||
brokerStats := balancer.NewBrokerStats()
|
var brokerStats *balancer.BrokerStats
|
||||||
if initMessage != nil {
|
if initMessage != nil {
|
||||||
|
var found bool
|
||||||
|
brokerStats, found = broker.Balancer.Brokers.Get(initMessage.Broker)
|
||||||
|
if !found {
|
||||||
|
brokerStats = balancer.NewBrokerStats()
|
||||||
broker.Balancer.Brokers.Set(initMessage.Broker, brokerStats)
|
broker.Balancer.Brokers.Set(initMessage.Broker, brokerStats)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO fix this
|
|
||||||
return status.Errorf(codes.InvalidArgument, "balancer init message is empty")
|
return status.Errorf(codes.InvalidArgument, "balancer init message is empty")
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user