ox.retry
Members list
Type members
Classlikes
A random factor used for calculating the delay between subsequent retries when a backoff strategy is used for calculating the delay.
A random factor used for calculating the delay between subsequent retries when a backoff strategy is used for calculating the delay.
The purpose of jitter is to avoid clustering of subsequent retries, i.e. to reduce the number of clients calling a service exactly at the same time - which can result in subsequent failures, contrary to what you would expect from retrying. By introducing randomness to the delays, the retries become more evenly distributed over time.
See the AWS Architecture Blog article on backoff and jitter for a more in-depth explanation.
Depending on the algorithm, the jitter can affect the delay in different ways - see the concrete variants for more details.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A policy that allows to customize when a non-erroneous result is considered successful and when an error is worth retrying (which allows for failing fast on certain errors).
A policy that allows to customize when a non-erroneous result is considered successful and when an error is worth retrying (which allows for failing fast on certain errors).
Type parameters
- E
-
The error type of the operation. For operations returning a
T
or aTry[T]
, this is fixed toThrowable
. For operations returning anEither[E, T]
, this can be anyE
. - T
-
The successful result type for the operation.
Value parameters
- isSuccess
-
A function that determines whether a non-erroneous result is considered successful. By default, every non-erroneous result is considered successful.
- isWorthRetrying
-
A function that determines whether an error is worth retrying. By default, all errors are retried.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ResultPolicy.type
A policy that defines how to retry a failed operation.
A policy that defines how to retry a failed operation.
Type parameters
- E
-
The error type of the operation. For operations returning a
T
or aTry[T]
, this is fixed toThrowable
. For operations returning anEither[E, T]
, this can be anyE
. - T
-
The successful result type for the operation.
Value parameters
- resultPolicy
-
A policy that allows to customize when a non-erroneous result is considered successful and when an error is worth retrying (which allows for failing fast on certain errors). See ResultPolicy for more details.
- schedule
-
The retry schedule which determines the maximum number of retries and the delay between subsequent attempts to execute the operation. See Schedule for more details.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
RetryPolicy.type
Value members
Concrete methods
Retries an operation returning a direct result until it succeeds or the policy decides to stop.
Retries an operation returning a direct result until it succeeds or the policy decides to stop.
Value parameters
- operation
-
The operation to retry.
- policy
-
The retry policy - see RetryPolicy.
Attributes
- Returns
-
The result of the function if it eventually succeeds.
- Throws
-
anything
The exception thrown by the last attempt if the policy decides to stop.
Retries an operation using the given error mode until it succeeds or the policy decides to stop. Note that any exceptions thrown by the operation aren't caught (unless the operation catches them as part of its implementation) and don't cause a retry to happen.
Retries an operation using the given error mode until it succeeds or the policy decides to stop. Note that any exceptions thrown by the operation aren't caught (unless the operation catches them as part of its implementation) and don't cause a retry to happen.
Value parameters
- em
-
The error mode to use, which specifies when a result value is considered success, and when a failure.
- operation
-
The operation to retry.
- policy
-
The retry policy - see RetryPolicy.
Attributes
- Returns
-
Either:
- the result of the function if it eventually succeeds, in the context of
F
, as dictated by the error mode. - the error
E
in contextF
as returned by the last attempt if the policy decides to stop.
- the result of the function if it eventually succeeds, in the context of
Retries an operation returning an scala.util.Either until it succeeds or the policy decides to stop. Note that any exceptions thrown by the operation aren't caught and don't cause a retry to happen.
Retries an operation returning an scala.util.Either until it succeeds or the policy decides to stop. Note that any exceptions thrown by the operation aren't caught and don't cause a retry to happen.
Value parameters
- operation
-
The operation to retry.
- policy
-
The retry policy - see RetryPolicy.
Attributes
- Returns
-
A scala.util.Right if the function eventually succeeds, or, otherwise, a scala.util.Left with the error from the last attempt.