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
Presently, the retryPolicy method specifies how often the circuit breaker should try before failing; however, in certain cases (e.g. expected failures) it is not desirable to continue retrying.
(If this feature exists, I couldn't find any mention of this in the documentation.)
Use cases
Something like a retryOrCancelPolicy would be desirable, where returning -1L would cease the circuit breaker from retrying:
I tend to use michaelbull/kotlin-retry for retrying, which has a pretty elegant way of handling retry policies.
For example:
val retryTimeouts:RetryPolicy<Throwable> = {
if (reason isSQLDataException) ContinueRetryingelseStopRetrying
}
suspendfunprintExchangeBetween(a:Long, b:Long) {
val customer1 = customers.nameFromId(a)
val customer2 = customers.nameFromId(b)
println("$customer1 exchanged with $customer2")
}
funmain() = runBlocking {
retry(retryTimeouts + limitAttempts(5) + constantDelay(20)) {
printExchangeBetween(1L, 2L)
}
}
Contribution
I will try to realize this if I get the time; right now I'm holed up with my work laptop, which does not allow me to push externally... even posting this issue was a pain. :|
The text was updated successfully, but these errors were encountered:
Describe the feature
Presently, the
retryPolicy
method specifies how often the circuit breaker should try before failing; however, in certain cases (e.g. expected failures) it is not desirable to continue retrying.(If this feature exists, I couldn't find any mention of this in the documentation.)
Use cases
Something like a
retryOrCancelPolicy
would be desirable, where returning-1L
would cease the circuit breaker from retrying:I tend to use michaelbull/kotlin-retry for retrying, which has a pretty elegant way of handling retry policies.
For example:
Contribution
I will try to realize this if I get the time; right now I'm holed up with my work laptop, which does not allow me to push externally... even posting this issue was a pain. :|
The text was updated successfully, but these errors were encountered: