Choose how long to wait between retries.
import Again.Schedule as Schedule exposing (Schedule(..))
schedule =
ImmediatelyThen
(ExponentialBackoff
{ initialDelay = 1000
, multiplier = 2
, maxDelay = 4000
}
)
delays =
List.map (Schedule.delay schedule) [ 0, 1, 2, 3, 4 ]This produces [ 0, 1000, 2000, 4000, 4000 ] milliseconds: retry immediately,
then back off up to four seconds.
Retry without waiting, every time. Equivalent to Periodic { delay = 0 }.
Choose how long to wait before each retry. All delays are in milliseconds.
Periodicuses the samedelayfor every retry.ExponentialBackoffstarts withinitialDelay, then multiplies the delay bymultiplierfor each subsequent retry, up tomaxDelay.ImmediatelyThenretries once without waiting, then follows the wrapped schedule from its first delay. Wrap it around either of the other variants, or nest it for several immediate retries.Choose a
multiplierof one or more and delays of zero or more, withmaxDelayat least as large asinitialDelay. The schedule uses your values as given, so make sure they're finite numbers.