Skip to content

Commit 2579e9c

Browse files
committed
fix: connection_timeout should not be 0.
1 parent 75c1637 commit 2579e9c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

databend-client/src/main/java/com/databend/client/ClientSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
public class ClientSettings {
2121
public static final Integer DEFAULT_QUERY_TIMEOUT = 300;
2222
// seconds
23-
public static final Integer DEFAULT_CONNECTION_TIMEOUT = 0;
23+
public static final Integer DEFAULT_CONNECTION_TIMEOUT = 60;
2424
public static final Integer DEFAULT_SOCKET_TIMEOUT = 0;
2525
public static final int DEFAULT_RETRY_ATTEMPTS = 5;
2626
public static final String X_Databend_Query_ID = "X-DATABEND-QUERY-ID";

databend-jdbc/src/main/java/com/databend/jdbc/DatabendDriverUri.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,9 @@ public void setupClient(OkHttpClient.Builder builder) throws SQLException {
451451
builder.addInterceptor(tokenAuth(ACCESS_TOKEN.getValue(properties).get()));
452452
}
453453
if (CONNECTION_TIMEOUT.getValue(properties).isPresent()) {
454-
builder.connectTimeout(CONNECTION_TIMEOUT.getValue(properties).get(), TimeUnit.SECONDS);
454+
Integer timeout = CONNECTION_TIMEOUT.getValue(properties).get();
455+
if (timeout != 0)
456+
builder.connectTimeout(timeout, TimeUnit.SECONDS);
455457
}
456458
if (SOCKET_TIMEOUT.getValue(properties).isPresent()) {
457459
builder.readTimeout(SOCKET_TIMEOUT.getValue(properties).get(), TimeUnit.SECONDS);

0 commit comments

Comments
 (0)