arrow-kt / arrow

Ξ›rrow - Functional companion to Kotlin's Standard Library
http://arrow-kt.io
Other
6.18k stars 452 forks source link

Allow specifying a more concrete Throwable type for retrying #3414

Closed nomisRev closed 5 months ago

nomisRev commented 6 months ago

Small use-case I came across several times, and I stumbled across it again. This PR allows specifying concrete types for retrying. I.e.

Schedule.exponential<PSQLException>(...)
  .and(Schedule.recurs(5))
  .doWhile { e: PSQLExeption, _ -> e.isRetryable() }
  .retry {
    exposedTransaction { doDatabaseStuff() }
  }

TODO

nomisRev commented 6 months ago

Platform declaration clash: The following declarations have the same JVM signature

Of course... πŸ˜‚

github-actions[bot] commented 5 months ago

Kover Report

File Coverage [68.39%]
arrow-libs/resilience/arrow-resilience/src/commonMain/kotlin/arrow/resilience/Schedule.kt 68.39%
Total Project Coverage 57.95%
serras commented 5 months ago

Should we close this now that #3418 is merged? I don't want to step on your toes...

nomisRev commented 5 months ago

Not stepping on my toes @serras 😘 Love collaborating together, the resulting Schedule is 😍