You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case this.unit is not milliseconds, this line will produce unexpected series of delay values. For example, leaving aside workingAttempts suared:
// this.unit == TImeUnit.SECONDSx = TimeUnit.toSeconds(1) // Let's assume we have got this from builderx = TimeUnit.toMillis(1) // First iteration// x == 1000x = TimeUnit.toMillis(1) // Second iteration// x == 1000000// and so on..
So in case unit is not millis then this conversion alone would add at least +/-3 orders of magnitude coefficient. I believe this was not the intention.
I think reasonable approach here would be to move all unit conversions to builder and then default to milliseconds internally.
Possibly related question is regarding this condition workingInterval <= 0. It may become true in case workingInterval <= 0 or workingAttempts == 0. The latter does not hold as it is initially 1 and always increased. workingInterval can be 0 or less only if we have percentOfMaxIntervalForJitter >= 100 which is not checked by builder...
Maybe use one of approaches suggested here instead? They are relatively easier to reason about.
The text was updated successfully, but these errors were encountered:
OK, it turns out that I cannot trigger this without modifying the ExponentialRetry code. ExponentialRetry.Builder#unit is declared as final with value TimeUnit.SECONDS and this is only value for which workingInterval = unit.toMillis(workingInterval) * (workingAttempts * workingAttempts); would work correctly and this is only time unit for which toMillis is identity.
See class ExponentialRety, here.
In case this.unit is not milliseconds, this line will produce unexpected series of delay values. For example, leaving aside workingAttempts suared:
So in case unit is not millis then this conversion alone would add at least +/-3 orders of magnitude coefficient. I believe this was not the intention.
I think reasonable approach here would be to move all unit conversions to builder and then default to milliseconds internally.
Possibly related question is regarding this condition
workingInterval <= 0
. It may become true in caseworkingInterval <= 0
orworkingAttempts == 0
. The latter does not hold as it is initially 1 and always increased.workingInterval
can be 0 or less only if we have percentOfMaxIntervalForJitter >= 100 which is not checked by builder...Maybe use one of approaches suggested here instead? They are relatively easier to reason about.
The text was updated successfully, but these errors were encountered: