The codebase I'm working with already has a way of defining retry limits through annotations, e.g.
@Retry( retryInterval = 60)fun doSomething(args: ...)
However the retry parameters need to be specified as function arguments, so the function caller can set them. I don't believe this is possible with annotations as the values must be set at compile time.
I need to retry while letting the function caller define the maximum retry interval (how long to retry for before timing out), and the retry interval (how frequently it is allowed to retry)
This is likely possible with while true
and wait
loops, but is there a more conventional method?