Packages

package retry

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. retry
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. 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.

  2. 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

  3. trait Jitter extends AnyRef
  4. 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

  5. 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.

  6. abstract class RetryWithDelay extends Policy
  7. class Success[-T] extends AnyRef
    Annotations
    @implicitNotFound()
  8. 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

  1. val Forever: Int
  2. object Jitter

    The algorithms here were inspired by this article: https://www.awsarchitectureblog.com/2015/03/backoff.html

  3. object Policy
  4. 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.

  5. object RetryUtil
  6. object RetryWithDelay
  7. object Success

Inherited from AnyRef

Inherited from Any

Ungrouped