object Schedules
Convenience methods to create common ZIO schedules for retrying
- Alphabetic
- By Inheritance
- Schedules
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- def common(min: zio.Duration = 1.second, max: zio.Duration = 1.minute, factor: Double = 2.0, retryImmediately: Boolean = true, maxRetries: Option[Int] = Some(3), jitterFactor: Double = 0.1): Schedule[Any, Any, (Any, Long)]
A common-practice schedule for retrying
A common-practice schedule for retrying
By default the first retry is done immediately. With transient / random failures this method gives the highest chance of fast success. After that Retry uses exponential backoff between some minimum and maximum duration. Jitter is added to prevent spikes of retries from multiple instances. An optional maximum number of retries ensures that retrying does not continue forever.
See also https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
- min
Minimum retry backoff delay
- max
Maximum backoff time. When this value is reached, subsequent intervals will be equal to this value.
- factor
Factor with which delays increase
- retryImmediately
Retry immediately after the first failure
- maxRetries
Maximum number of retries
- jitterFactor
Maximum fraction of the current delay interval that is randomly added or subtracted. This helps to spread call attempts in time when there are multiple systems making calls to some system using the same retry schedule. For example, with
jitterFactor = 0.1
the retry intervals will be multiplied with a random factor between 0.9 and 1.1.jitterFactor = 0
disables jittering.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exponentialBackoff[E](min: zio.Duration, max: zio.Duration, factor: Double = 2.0): Schedule[Any, E, zio.Duration]
Schedule for exponential backoff up to a maximum interval
Schedule for exponential backoff up to a maximum interval
- E
Schedule input
- min
Minimum backoff time
- max
Maximum backoff time. When this value is reached, subsequent intervals will be equal to this value.
- factor
Exponential factor. 2 means doubling, 1 is constant, < 1 means decreasing
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def whenCase[Env, In, Out](pf: PartialFunction[In, Any])(schedule: Schedule[Env, In, Out]): Schedule[Env, In, (In, Out)]
Apply the given schedule only when inputs match the partial function
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
- Deprecated