Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ChathurangaKCD committed Jan 25, 2021
1 parent 618c52b commit 6cbc1ab
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/modules/gitops/manifest-group.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { defer, EMPTY, Observable, of } from 'rxjs';
import { defer, EMPTY, Observable, of, timer } from 'rxjs';
import {
catchError,
delay,
filter,
map,
mergeAll,
Expand Down Expand Up @@ -102,13 +101,12 @@ function fetchResourcesOfType(query: ResourceQuery, r: ResourceType) {
}).pipe(
retryWhen((errors) =>
errors.pipe(
delay(1000),
mergeMap((v, i) => {
// error msg available, no need to retry
if (v instanceof YamlFectchFailure && v.cause) throw v;
// allow 2 retries
if (i >= 2) throw v;
return of(null);
// allow 2 retries, retry in 1s
if (i > 1) throw v;
return timer(1000);
})
)
),
Expand Down

0 comments on commit 6cbc1ab

Please sign in to comment.