时间过长时重试连接
Retry connection when it takes too long
是否可以在 Angular 中在呼叫停留超过几秒钟时重试连接?
应该可以通过 Rxjs 中的 pipe
、timeout
和 retry
的组合来实现。如果超过timeout
,retry
4次,否则,catchError
.
return this.httpClient.post(url, data, httpOptions).pipe(
timeout(3000),
retry(4),
catchError(<DO SOMETHING>)
);
是否可以在 Angular 中在呼叫停留超过几秒钟时重试连接?
应该可以通过 Rxjs 中的 pipe
、timeout
和 retry
的组合来实现。如果超过timeout
,retry
4次,否则,catchError
.
return this.httpClient.post(url, data, httpOptions).pipe(
timeout(3000),
retry(4),
catchError(<DO SOMETHING>)
);