These functions receive a lot of parameters and it is easy to get lost. I would refactor this to receive a struct instead with all the config. This will also make passing a default (which is what we are doing in most if not all retryable functions) much easier, as you would only pass one param and reuse the struct. I'll give you a hint:
typeRetryConfig {
MinDelay time.DurationMaxIntervaltime.DurationMaxDelaytime.DurationRetryFactorfloat64NumRetriesuint64
}
funcRetryWithData[Tany](functionToRetryfunc() (T,error), config*RetryConfig) { }
// The you would you use like so funcfoo() {
RetryWithData(funcToRetry, &RetryConfig{ RetryFactor: 5 , ...})
}Originally posted by @MarcosNicolau in #1304 (comment)
These functions receive a lot of parameters and it is easy to get lost. I would refactor this to receive a struct instead with all the config. This will also make passing a default (which is what we are doing in most if not all retryable functions) much easier, as you would only pass one param and reuse the struct. I'll give you a hint:
Originally posted by @MarcosNicolau in #1304 (comment)