UNPKG

timing-provider

Version:

An implementation of the timing provider specification.

14 lines 523 B
import { defer, iif, retry, tap, throwError, timer } from 'rxjs'; export const retryBackoff = () => (source) => defer(() => { const attempts = 4; const interval = 1000; let index = 0; return source.pipe(retry({ delay: (error) => { index += 1; return iif(() => index < attempts, timer(interval * index ** 2), throwError(() => error) // tslint:disable-line:rxjs-throw-error ); } }), tap(() => (index = 0))); }); //# sourceMappingURL=retry-backoff.js.map