When reviewing the function tryRefreshMetadata() in client.go, I noticed a shared variable attemptsRemaining (initialized as Metadata.Retry.Max) within the subfunction retry(). Every call to the function retry() decreases the value of attemptsRemaining. For instance, if the initial value of attemptsRemaining is 3, when the broker is unavailable, it decreases by 1. In another scenario where there is no leader for some partitions, attemptsRemaining decreases from 2 instead of the initial value of 3. Shouldn't it be reset for different reasons?
Description
When reviewing the function tryRefreshMetadata() in client.go, I noticed a shared variable attemptsRemaining (initialized as Metadata.Retry.Max) within the subfunction retry(). Every call to the function retry() decreases the value of attemptsRemaining. For instance, if the initial value of attemptsRemaining is 3, when the broker is unavailable, it decreases by 1. In another scenario where there is no leader for some partitions, attemptsRemaining decreases from 2 instead of the initial value of 3. Shouldn't it be reset for different reasons?
The snippet of the func tryRefreshMetadata()
Sarama version: 1.42.2