backoff-rxjs
A collection of helpful RxJS operators to deal with backoff strategies (like exponential backoff)
intervalExponential
intervalExponential
works similiarly to interval
except that it doubles the delay between emissions every time.
name | type | attirbute | description |
---|
config | number | IntervalExponentialConfig | required | Can take number as initial interval or a config with initial interval and optional max Interval |
intervalExponential
is especially useful for periodic polls that are reset whenever user activity is detected:
fromEvent(document, 'mousemove').pipe(
sampleTime(LOAD_INTERVAL_MS),
startWith(null),
switchMapTo(intervalExponential({initialInterval: LOAD_INTERVAL_MS, maxInterval: MAX_INTERVAL_MS})),
);
retryExponentialBackoff
name | type | attirbute | description |
---|
config | number | IntervalExponentialConfig | required | Can take number as initial interval or a config with initial interval and optional max Interval |