xstream-backoff
pnpm install --save xstream-backoff
Creates an xstream Stream that emits numbers in exponential backoff periods of time.
Description
Creates a stream that periodically emits incremental numbers, where the interval of time varies exponentially.
Marble diagram:
backoff(500, 2, 6000)-0---1-------2---------------3-----------------------4----... intervals:500ms 1s 2s 4s 6s
Arguments:
interval
: initial interval of time expressed in millisecondsfactor
: (optional, default2
) how much to multiply the previousinterval
each time the stream emitsmaximum
: (optional, defaultInfinity
) the maximum interval at which to limit the interval calculation
Usage
const source = source
> 0> 1> 2> 3> 4
License
MIT