Skip to content

Commit

Permalink
Comments on stack safety
Browse files Browse the repository at this point in the history
  • Loading branch information
adelbertc committed Mar 11, 2015
1 parent 719eb31 commit 2029268
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/main/scala/rebind/RetryPolicy.scala
Expand Up @@ -66,6 +66,8 @@ final case class RetryPolicy(private[rebind] val run: Int => Option[FiniteDurati
*
* Limits are compared against the total number of times the error has occured so far,
* regardless of when they occured (e.g. occured non-consecutively).
*
* Stack safe so long as `F[_]` is.
*/
def recover[F[_] : Monad, E : Equal, A](action: DisjunctionT[F, E, A])(limits: E => Count): DisjunctionT[F, E, A] = {
def checkError(error: E, history: IList[(E, Int)], iteration: Int): Option[IList[(E, Int)]] =
Expand Down Expand Up @@ -105,6 +107,8 @@ final case class RetryPolicy(private[rebind] val run: Int => Option[FiniteDurati
* Limits are compared against consecutive occurences. For instance, if a particular error
* is mapped to `5.times` and so far it has failed consecutively 4 times but then fails with
* a different error, the count is reset.
*
* Stack safe so long as `F[_]` is.
*/
def recoverConsecutive[F[_] : Monad, E : Equal, A](action: DisjunctionT[F, E, A])(limits: E => Count): DisjunctionT[F, E, A] = {
def checkError(error: E, count: Option[(E, Int)], iteration: Int): Option[(Option[(E, Int)])] =
Expand Down

0 comments on commit 2029268

Please sign in to comment.