Examples
Let's try some example of creating and combining schedules.
- Stop retrying after a specified amount of time has elapsed:
val expMaxElapsed = (Schedule.exponential(10.milliseconds) >>> Schedule.elapsed).whileOutput(_ < 30.seconds)
- Retry only when a specific exception occurs:
import scala.concurrent.TimeoutException
val whileTimeout = Schedule.exponential(10.milliseconds) && Schedule.recurWhile[Throwable] {
case _: TimeoutException => true
case _ => false
}