Skip to content

Commit

Permalink
remove timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
JNSimba committed Feb 21, 2025
1 parent ab9412d commit c78e4fd
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,30 @@
import org.apache.http.protocol.RequestContent;

import static org.apache.doris.flink.cfg.ConfigurationOptions.DORIS_REQUEST_CONNECT_TIMEOUT_MS_DEFAULT;
import static org.apache.doris.flink.cfg.ConfigurationOptions.DORIS_REQUEST_READ_TIMEOUT_MS_DEFAULT;

/** util to build http client. */
public class HttpUtil {
private final int connectTimeout;
private final int socketTimeout;
private final int waitForContinueTimeout;
private HttpClientBuilder httpClientBuilder;

public HttpUtil() {
this.connectTimeout = DORIS_REQUEST_CONNECT_TIMEOUT_MS_DEFAULT;
this.socketTimeout = DORIS_REQUEST_READ_TIMEOUT_MS_DEFAULT;
this.waitForContinueTimeout = DORIS_REQUEST_CONNECT_TIMEOUT_MS_DEFAULT;
settingStreamHttpClientBuilder();
}

public HttpUtil(DorisReadOptions readOptions) {
this.connectTimeout = readOptions.getRequestConnectTimeoutMs();
this.socketTimeout = readOptions.getRequestReadTimeoutMs();
this.waitForContinueTimeout = readOptions.getRequestConnectTimeoutMs();
settingStreamHttpClientBuilder();
}

private void settingStreamHttpClientBuilder() {
this.httpClientBuilder =
HttpClients.custom()
// default timeout 3s, maybe report 307 error when fe busy
.setRequestExecutor(new HttpRequestExecutor(socketTimeout))
.setRequestExecutor(new HttpRequestExecutor(waitForContinueTimeout))
.setRedirectStrategy(
new DefaultRedirectStrategy() {
@Override
Expand Down Expand Up @@ -97,7 +96,9 @@ protected boolean isRedirectable(String method) {
RequestConfig.custom()
.setConnectTimeout(connectTimeout)
.setConnectionRequestTimeout(connectTimeout)
.setSocketTimeout(socketTimeout)
// todo: Need to be extracted to DorisExecutionOption
// default checkpoint timeout is 10min
.setSocketTimeout(9 * 60 * 1000)
.build());
}

Expand All @@ -108,7 +109,9 @@ public HttpClientBuilder getHttpClientBuilderForCopyBatch() {
RequestConfig.custom()
.setConnectTimeout(connectTimeout)
.setConnectionRequestTimeout(connectTimeout)
.setSocketTimeout(socketTimeout)
// todo: Need to be extracted to DorisExecutionOption
// default checkpoint timeout is 10min
.setSocketTimeout(9 * 60 * 1000)
.build());
}
}

0 comments on commit c78e4fd

Please sign in to comment.