Schedule

ox.scheduling.Schedule
See theSchedule companion object
case class Schedule(intervals: () => LazyList[FiniteDuration], initialDelay: Option[FiniteDuration])

Describes a schedule according to which ox.resilience.retry, repeat and schedule will invoke operations. A schedule is essentially a list of intervals, which are used to determine how long to wait before subsequent invocations of the operation.

Implementation note: the intervals lazy-list is lazy-evaluated itself, to avoid memory leaks when a schedule is captured as a value and used multiple times. The intervals list is re-created on every usage, which isn't optimal, but due to the small size (and gradual evaluation) of the list, should not cause any performance issues.

Value parameters

initialDelay

The delay to wait before running the operation for the first time - if any.

intervals

The intervals to use for the schedule.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def ++(other: Schedule): Schedule

Attributes

See also
def andThen(other: Schedule): Schedule

Combines two schedules. The second schedule will only be used if the first one is finite.

Combines two schedules. The second schedule will only be used if the first one is finite.

Attributes

Adds random jitter to each interval, using the provided jitter mode.

Adds random jitter to each interval, using the provided jitter mode.

The purpose of jitter is to avoid clustering of subsequent invocations, i.e. to reduce the number of clients calling a service exactly at the same time - which can result in failures, contrary to what you would expect e.g. when retrying. By introducing randomness to the delays, the repetitions become more evenly distributed over time.

Attributes

See also
def maxAttempts(max: Int): Schedule

Caps the number of attempts to the given maximum, creating a finite schedule. The provided value specifies the total number of invocations (attempts) of the operation, including the initial invocation.

Caps the number of attempts to the given maximum, creating a finite schedule. The provided value specifies the total number of invocations (attempts) of the operation, including the initial invocation.

Attributes

def maxCumulativeDelay(upTo: FiniteDuration): Schedule

Caps the total delay (cumulative time between attempts) to the given maximum. The resulting schedule might still be infinite, if the intervals are originally 0.

Caps the total delay (cumulative time between attempts) to the given maximum. The resulting schedule might still be infinite, if the intervals are originally 0.

Attributes

def maxInterval(max: FiniteDuration): Schedule

Caps the intervals to the given maximum.

Caps the intervals to the given maximum.

Attributes

def maxRetries(retries: Int): Schedule

Caps the number of retries to the given maximum, creating a finite schedule. The provided value specifies the number of retries after the initial attempt. The total number of invocations will be retries + 1.

Caps the number of retries to the given maximum, creating a finite schedule. The provided value specifies the number of retries after the initial attempt. The total number of invocations will be retries + 1.

Attributes

def withInitialDelay(interval: FiniteDuration): Schedule

Modifies the schedule so that operations are only run after the initial given delay. Later, the intervals specified by the schedule are used.

Modifies the schedule so that operations are only run after the initial given delay. Later, the intervals specified by the schedule are used.

Attributes

Modifies the schedule so that the first invocation of the operation is run immediately, with subsequent invocations following the intervals specified by the schedule.

Modifies the schedule so that the first invocation of the operation is run immediately, with subsequent invocations following the intervals specified by the schedule.

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product