From 42922191444af9d6c2a0fc51edef0f9b453f32f5 Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Tue, 7 Jul 2020 08:38:32 -0700 Subject: [PATCH] sarama: fix isBalanced() signature --- balance_strategy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/balance_strategy.go b/balance_strategy.go index d9789a026..8f3fe1b75 100644 --- a/balance_strategy.go +++ b/balance_strategy.go @@ -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 { @@ -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 }