Skip to content

Commit

Permalink
#655 give a random index for NewSubscriptionLoadBalancer
Browse files Browse the repository at this point in the history
  • Loading branch information
kingkh1995 committed Dec 26, 2023
1 parent 2d3cdf7 commit daa9594
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions golang/loadBalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"sync"
"sync/atomic"
"math/rand"

"github.com/apache/rocketmq-clients/golang/v5/pkg/utils"
v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2"
Expand Down Expand Up @@ -134,6 +135,7 @@ var _ = SubscriptionLoadBalancer(&subscriptionLoadBalancer{})
var NewSubscriptionLoadBalancer = func(messageQueues []*v2.MessageQueue) (SubscriptionLoadBalancer, error) {
slb := &subscriptionLoadBalancer{
messageQueues: messageQueues,
index: rand.Int31()
}
return slb, nil
}
Expand Down

0 comments on commit daa9594

Please sign in to comment.