时间过长时重试连接

Retry connection when it takes too long

是否可以在 Angular 中在呼叫停留超过几秒钟时重试连接?

应该可以通过 Rxjs 中的 pipetimeoutretry 的组合来实现。如果超过timeoutretry4次,否则,catchError.

return this.httpClient.post(url, data, httpOptions).pipe(
  timeout(3000),
  retry(4),
  catchError(<DO SOMETHING>)
);