package retry
- Alphabetic
- By Inheritance
- retry
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final case class Backoff(logger: TracedLogger, flagCloseable: FlagCloseable, maxRetries: Int, initialDelay: FiniteDuration, maxDelay: Duration, operationName: String, longDescription: String = "", actionable: Option[String] = None, retryLogLevel: Option[Level] = None)(implicit jitter: Jitter = Jitter.full(maxDelay)) extends RetryWithDelay with Product with Serializable
A retry policy which will back off using a configurable policy which incorporates random jitter.
A retry policy which will back off using a configurable policy which incorporates random jitter. This has the advantage of reducing contention if you have threaded clients using the same service.
val policy = retry.Backoff() val future = policy(issueRequest)
The following pre-made jitter algorithms are available for you to use:
You can choose one like this:
implicit val jitter = retry.Jitter.full(cap = 5.minutes) val policy = retry.Backoff(1 second) val future = policy(issueRequest)
If a jitter policy isn't in scope, it will use Jitter.full by default which tends to cause clients slightly less work at the cost of slightly more time.
For more information about the algorithms, see the following article:
https://www.awsarchitectureblog.com/2015/03/backoff.html
If the retry is not successful after
maxRetries
, the future is completed with its last result. - final case class Directly(logger: TracedLogger, flagCloseable: FlagCloseable, maxRetries: Int, operationName: String, longDescription: String = "", retryLogLevel: Option[Level] = None) extends RetryWithDelay with Product with Serializable
Retry immediately after failure for a max number of times
- trait Jitter extends AnyRef
- final case class Pause(logger: TracedLogger, flagCloseable: FlagCloseable, maxRetries: Int, delay: FiniteDuration, operationName: String, longDescription: String = "", actionable: Option[String] = None, retryLogLevel: Option[Level] = None) extends RetryWithDelay with Product with Serializable
Retry with a pause between attempts for a max number of times
- abstract class Policy extends AnyRef
A retry com.digitalasset.canton.util.retry.Policy defines an interface for retrying a future-based task with retry semantics specific to implementations.
A retry com.digitalasset.canton.util.retry.Policy defines an interface for retrying a future-based task with retry semantics specific to implementations. If the task throws a non-fatal exceptions synchronously, the exception is converted into an asynchronous one, i.e., it is returned as a failed future or retried.
If unsure about what retry policy to pick, com.digitalasset.canton.util.retry.Backoff is a good default.
- abstract class RetryWithDelay extends Policy
- class Success[-T] extends AnyRef
- Annotations
- @implicitNotFound()
- final case class When(logger: TracedLogger, depends: PartialFunction[Any, Policy]) extends Policy with Product with Serializable
A retry policy in which the failure determines the way a future should be retried.
A retry policy in which the failure determines the way a future should be retried. The partial function
depends
provided may define the domain of both the success OR exceptional failure of a future fails explicitly.val policy = retry.When { case RetryAfter(retryAt) => retry.Pause(delay = retryAt) } val future = policy(issueRequest)
If the result is not defined for the depends block, the future will not be retried.
Value Members
- val Forever: Int
- object Jitter
The algorithms here were inspired by this article: https://www.awsarchitectureblog.com/2015/03/backoff.html
- object Policy
- object RetryEither
Simple form of the retry policies that operate on Either and not Future[T].
Simple form of the retry policies that operate on Either and not Future[T]. Only provides a Pause-based retry.
- object RetryUtil
- object RetryWithDelay
- object Success