Browse Source

go fmt

pull/5637/head
chrislu 9 months ago
parent
commit
529fa8c4c8
  1. 4
      weed/mq/broker/broker_grpc_pub_follow.go
  2. 5
      weed/mq/broker/broker_grpc_sub.go
  3. 4
      weed/mq/pub_balancer/allocate.go

4
weed/mq/broker/broker_grpc_pub_follow.go

@ -12,7 +12,7 @@ import (
"time" "time"
) )
func (b *MessageQueueBroker) PublishFollowMe(c context.Context, request *mq_pb.PublishFollowMeRequest) (*mq_pb.PublishFollowMeResponse, error){
func (b *MessageQueueBroker) PublishFollowMe(c context.Context, request *mq_pb.PublishFollowMeRequest) (*mq_pb.PublishFollowMeResponse, error) {
glog.V(0).Infof("PublishFollowMe %v", request) glog.V(0).Infof("PublishFollowMe %v", request)
var wg sync.WaitGroup var wg sync.WaitGroup
wg.Add(1) wg.Add(1)
@ -75,7 +75,7 @@ func (b *MessageQueueBroker) doFollowInMemoryMessage(c context.Context, client m
} }
if resp.Message != nil { if resp.Message != nil {
// process ctrl message or data message // process ctrl message or data message
switch m:= resp.Message.(type) {
switch m := resp.Message.(type) {
case *mq_pb.FollowInMemoryMessagesResponse_Data: case *mq_pb.FollowInMemoryMessagesResponse_Data:
// process data message // process data message
print("d") print("d")

5
weed/mq/broker/broker_grpc_sub.go

@ -188,8 +188,7 @@ func (b *MessageQueueBroker) FollowInMemoryMessages(req *mq_pb.FollowInMemoryMe
// to indicate the follower is connected // to indicate the follower is connected
stream.Send(&mq_pb.FollowInMemoryMessagesResponse{ stream.Send(&mq_pb.FollowInMemoryMessagesResponse{
Message: &mq_pb.FollowInMemoryMessagesResponse_Ctrl{ Message: &mq_pb.FollowInMemoryMessagesResponse_Ctrl{
Ctrl: &mq_pb.FollowInMemoryMessagesResponse_CtrlMessage{
},
Ctrl: &mq_pb.FollowInMemoryMessagesResponse_CtrlMessage{},
}, },
}) })
@ -200,7 +199,7 @@ func (b *MessageQueueBroker) FollowInMemoryMessages(req *mq_pb.FollowInMemoryMe
var prevFlushTsNs int64 var prevFlushTsNs int64
_,_, err = localTopicPartition.LogBuffer.LoopProcessLogData(clientName, startPosition, 0, func() bool {
_, _, err = localTopicPartition.LogBuffer.LoopProcessLogData(clientName, startPosition, 0, func() bool {
if !isConnected { if !isConnected {
return false return false
} }

4
weed/mq/pub_balancer/allocate.go

@ -102,7 +102,7 @@ func EnsureAssignmentsToActiveBrokers(activeBrokers cmap.ConcurrentMap[string, *
assignment.LeaderBroker = "" assignment.LeaderBroker = ""
count++ count++
} }
for i:=0; i<followerCount; i++ {
for i := 0; i < followerCount; i++ {
if i >= len(assignment.FollowerBrokers) { if i >= len(assignment.FollowerBrokers) {
count++ count++
continue continue
@ -128,7 +128,7 @@ func EnsureAssignmentsToActiveBrokers(activeBrokers cmap.ConcurrentMap[string, *
hasEmptyFollowers := false hasEmptyFollowers := false
j := 0 j := 0
for ; j<len(assignment.FollowerBrokers); j++ {
for ; j < len(assignment.FollowerBrokers); j++ {
if assignment.FollowerBrokers[j] == "" { if assignment.FollowerBrokers[j] == "" {
hasChanges = true hasChanges = true
if i < len(pickedBrokers) { if i < len(pickedBrokers) {

Loading…
Cancel
Save