181
182
// caller to ensure that lock is obtained before call this function
183
>
func (b *tqLoadBalancer) pickReadPartitionWithFewestPolls(partitionCount int) int {
loadbalancer.go
184
>
// pick a random partition to start with
185
>
startPartitionID := rand.Intn(partitionCount)
186
>
pickedPartitionID := startPartitionID
187
>
minPollerCount := b.pollerCounts[pickedPartitionID]
188
>
for i := 1; i < partitionCount && minPollerCount > 0; i++ {
189
currPartitionID := (startPartitionID + i) % int(partitionCount)
190
if b.pollerCounts[currPartitionID] < minPollerCount {