retryOrElseEither

suspend fun <Input, Output, A> Schedule<Throwable, Output>.retryOrElseEither(action: suspend () -> Input, orElse: suspend (Throwable, Output) -> A): Either<A, Input>(source)

Retries action using any Throwable that occurred as the input to the Schedule. If the Schedule is exhausted, it will invoke orElse with the last exception and the output of the Schedule to produce a fallback value of A. Returns Either with the fallback value if the Schedule is exhausted, or the successful result of action.