Skip to content

Commit

Permalink
Merge pull request #1744 from alrs/fix-balanced-signature
Browse files Browse the repository at this point in the history
sarama: Fix isBalanced Function Signature
  • Loading branch information
d1egoaz committed Jul 15, 2020
2 parents ec4f2e8 + 4292219 commit bf41722
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions balance_strategy.go
Expand Up @@ -373,8 +373,8 @@ func getBalanceScore(assignment map[string][]topicPartitionAssignment) int {
}

// Determine whether the current assignment plan is balanced.
func isBalanced(currentAssignment map[string][]topicPartitionAssignment, sortedCurrentSubscriptions []string, allSubscriptions map[string][]topicPartitionAssignment) bool {
sortedCurrentSubscriptions = sortMemberIDsByPartitionAssignments(currentAssignment)
func isBalanced(currentAssignment map[string][]topicPartitionAssignment, allSubscriptions map[string][]topicPartitionAssignment) bool {
sortedCurrentSubscriptions := sortMemberIDsByPartitionAssignments(currentAssignment)
min := len(currentAssignment[sortedCurrentSubscriptions[0]])
max := len(currentAssignment[sortedCurrentSubscriptions[len(sortedCurrentSubscriptions)-1]])
if min >= max-1 {
Expand Down Expand Up @@ -430,7 +430,7 @@ func (s *stickyBalanceStrategy) performReassignments(reassignablePartitions []to
// reassign all reassignable partitions (starting from the partition with least potential consumers and if needed)
// until the full list is processed or a balance is achieved
for _, partition := range reassignablePartitions {
if isBalanced(currentAssignment, sortedCurrentSubscriptions, consumer2AllPotentialPartitions) {
if isBalanced(currentAssignment, consumer2AllPotentialPartitions) {
break
}

Expand Down

0 comments on commit bf41722

Please sign in to comment.