DelayStrategy

interface DelayStrategy

Represents a strategy for computing delay times based on an index.

Complex delay strategies can be composed using arithmetic operators and min/max coercion methods

Since

1.0.0

Properties

Functions

Link copied to clipboard
open fun coerceAtLeast(minimumValue: Duration): DelayStrategy

Ensures that the delay durations of this strategy are at least of the specified minimumValue.

Link copied to clipboard
open fun coerceAtMost(maximumValue: Duration): DelayStrategy

Ensures that the delay durations of this strategy are at most of the specified maximumValue.

Link copied to clipboard

Ensures that the delay durations of this strategy are within the specified duration range.

open fun coerceIn(minimumValue: Duration, maximumValue: Duration): DelayStrategy

Ensures that the delay durations of this strategy are within the specified range.

Link copied to clipboard
open operator fun div(divisor: Double): DelayStrategy

Divides the delay duration of this strategy by the given double divisor when get is called for a given index.

open operator fun div(divisor: Int): DelayStrategy

Divides the delay duration of this strategy by the given integer divisor when get is called for a given index.

Link copied to clipboard
abstract operator fun get(index: Int): Duration

Gets the delay for the given retry index.

Link copied to clipboard
open operator fun minus(other: DelayStrategy): DelayStrategy

Combines this strategy with another by subtracting their delay durations when get is called for a given index.

Link copied to clipboard
open operator fun plus(other: DelayStrategy): DelayStrategy

Combines this strategy with another by summing their delay durations when get is called for a given index.

Link copied to clipboard
open operator fun times(factor: Double): DelayStrategy

Multiplies the delay duration of this strategy by the given double factor when get is called for a given index.

open operator fun times(factor: Int): DelayStrategy

Multiplies the delay duration of this strategy by the given integer factor when get is called for a given index.

Link copied to clipboard
open operator fun unaryMinus(): DelayStrategy

Inverts the delay duration of this strategy when get is called for a given index.

Link copied to clipboard
open operator fun unaryPlus(): DelayStrategy

Returns this delay strategy unchanged. This function exists mainly for symmetry purposes.

Link copied to clipboard

Combines a DelayStrategy with a RetryPredicate to create a RetryPolicy.

Link copied to clipboard
open fun withJitter(jitterFactor: Double, random: Random = Random.Default): DelayStrategy

Introduces jitter (randomness) to the retry delay, spreading out the timing of retries.