apollo 的重試規則

在開發時能夠借鑑java

//post,delete,put請求在admin server處理超時狀況下不重試
  private boolean canRetry(Throwable e, HttpMethod method) {
    Throwable nestedException = e.getCause();
    if (method == HttpMethod.GET) {
      return nestedException instanceof SocketTimeoutException
             || nestedException instanceof HttpHostConnectException
             || nestedException instanceof ConnectTimeoutException;
    } else {
      return nestedException instanceof HttpHostConnectException
             || nestedException instanceof ConnectTimeoutException;
    }
  }
相關文章
相關標籤/搜索