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"
)
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)
var wg sync.WaitGroup
wg.Add(1)
@ -75,7 +75,7 @@ func (b *MessageQueueBroker) doFollowInMemoryMessage(c context.Context, client m
}
if resp.Message != nil {
// process ctrl message or data message
switch m:= resp.Message.(type) {
switch m := resp.Message.(type) {
case *mq_pb.FollowInMemoryMessagesResponse_Data:
// process data message
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
stream.Send(&mq_pb.FollowInMemoryMessagesResponse{
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
_,_, err = localTopicPartition.LogBuffer.LoopProcessLogData(clientName, startPosition, 0, func() bool {
_, _, err = localTopicPartition.LogBuffer.LoopProcessLogData(clientName, startPosition, 0, func() bool {
if !isConnected {
return false
}

4
weed/mq/pub_balancer/allocate.go

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

Loading…
Cancel
Save