Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A retry function #2

Closed
johanandren opened this issue Mar 25, 2015 · 1 comment
Closed

A retry function #2

johanandren opened this issue Mar 25, 2015 · 1 comment
Milestone

Comments

@johanandren
Copy link
Owner

Given a block that creates a future a it would be nice to have something that will retry that future if it fails.

For example, given a max number of retries and a predicate to decide if a given exception should lead to retry or not, something like this:

val retryFor = {
  case ex: RetryableException => true
  case _ => false
}
val result: Future[Int] = retry(maxTimes = 3,  decider = retryFor) {
  doSomeFutureStuff(): Future[Int]
}
@johanandren johanandren added this to the 1.1.0 milestone Mar 25, 2015
@johanandren
Copy link
Owner Author

Additionally, almost the same but with exponential back off?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant