From df20de5ce032d4260985fc38754eb88189d82422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20H=C4=83loiu?= Date: Sat, 9 May 2020 14:45:44 +0200 Subject: [PATCH] Fix referential transparency issue --- src/operators/retryBackoff.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/operators/retryBackoff.ts b/src/operators/retryBackoff.ts index bfc0538..0dcebde 100644 --- a/src/operators/retryBackoff.ts +++ b/src/operators/retryBackoff.ts @@ -1,4 +1,4 @@ -import { iif, Observable, throwError, timer } from 'rxjs'; +import { defer, iif, Observable, throwError, timer } from 'rxjs'; import { concatMap, retryWhen, tap } from 'rxjs/operators'; import { exponentialBackoffDelay, getDelay } from '../utils'; @@ -37,7 +37,7 @@ export function retryBackoff( resetOnSuccess = false, backoffDelay = exponentialBackoffDelay } = typeof config === 'number' ? { initialInterval: config } : config; - return (source: Observable) => { + return (source: Observable) => defer(() => { let index = 0; return source.pipe( retryWhen(errors => @@ -58,5 +58,5 @@ export function retryBackoff( } }) ); - } + }) }