Browse Source

read existing broker stats

pull/4865/head
chrislu 1 year ago
parent
commit
dff2ce5d2f
  1. 8
      weed/mq/broker/broker_grpc_balancer.go

8
weed/mq/broker/broker_grpc_balancer.go

@ -20,11 +20,15 @@ func (broker *MessageQueueBroker) ConnectToBalancer(stream mq_pb.SeaweedMessagin
// process init message
initMessage := req.GetInit()
brokerStats := balancer.NewBrokerStats()
var brokerStats *balancer.BrokerStats
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)
}
} else {
// TODO fix this
return status.Errorf(codes.InvalidArgument, "balancer init message is empty")
}
defer func() {

Loading…
Cancel
Save