How to use the retryWhen function from rxjs

Find comprehensive JavaScript rxjs.retryWhen code examples handpicked from public code repositorys.

3
4
5
6
7
8
9
10
11
12

const EXCHANGE = 'sepal.topic'
const RETRY_DELAY_MS = 10000

const retry = delay => pipe(
    retryWhen(error$ =>
        error$.pipe(
            mergeMap(
                error => {
                    log.warn(`Reconnecting in ${delay}ms after error: ${error}`)
fork icon45
star icon178
watch icon34

120
121
122
123
124
125
126
127
128
129
        return of(e)
    } else {
        return throwError(() => e)
    }
}),
retryWhen(function (error$) {
    return zip(
        error$,
        range(1, retries + 1)
    ).pipe(
fork icon45
star icon178
watch icon34