Skip to content

Commit

Permalink
Fix referential transparency issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vially committed May 9, 2020
1 parent d1356ab commit df20de5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/operators/retryBackoff.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -37,7 +37,7 @@ export function retryBackoff(
resetOnSuccess = false,
backoffDelay = exponentialBackoffDelay
} = typeof config === 'number' ? { initialInterval: config } : config;
return <T>(source: Observable<T>) => {
return <T>(source: Observable<T>) => defer(() => {
let index = 0;
return source.pipe(
retryWhen<T>(errors =>
Expand All @@ -58,5 +58,5 @@ export function retryBackoff(
}
})
);
}
})
}

0 comments on commit df20de5

Please sign in to comment.