【发布时间】:2020-02-26 19:50:15
【问题描述】:
我正在使用 redux-observables 以及 rxjs 和 backoff rxjs 进行重试,现在我有这个史诗,它将在服务器上请求,如果请求失败,它将调度一个 redux 操作并重试该功能。
defer(callApi).pipe(
catchError((error) => {
return actions.hasError(error) // dispatch to redux
}),
// this should retry the request 10 times
retryBackoff({
shouldRetry: true,
initialInterval: 1000,
maxRetries: 10
})
执行上面的代码似乎只做一件事(以先到者为准)。如何做到这一点,以便在出现错误时触发操作并同时重试?
【问题讨论】:
标签: javascript functional-programming rxjs redux-observable