Merge pull request #2584 from wolfgangzhu/hotifx/back_issue

[ISSUE#2577] Fix naming client http read timeout and connect timeout properties
This commit is contained in:
liaochuntao 2020-04-04 18:15:31 +08:00 committed by GitHub
commit 4e52ff050a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,8 +38,8 @@ import static com.alibaba.nacos.client.utils.LogUtils.NAMING_LOGGER;
*/ */
public class HttpClient { public class HttpClient {
public static final int TIME_OUT_MILLIS = Integer public static final int READ_TIME_OUT_MILLIS = Integer
.getInteger("com.alibaba.nacos.client.naming.ctimeout", 50000); .getInteger("com.alibaba.nacos.client.naming.rtimeout", 50000);
public static final int CON_TIME_OUT_MILLIS = Integer public static final int CON_TIME_OUT_MILLIS = Integer
.getInteger("com.alibaba.nacos.client.naming.ctimeout", 3000); .getInteger("com.alibaba.nacos.client.naming.ctimeout", 3000);
private static final boolean ENABLE_HTTPS = Boolean private static final boolean ENABLE_HTTPS = Boolean
@ -73,7 +73,7 @@ public class HttpClient {
setHeaders(conn, headers, encoding); setHeaders(conn, headers, encoding);
conn.setConnectTimeout(CON_TIME_OUT_MILLIS); conn.setConnectTimeout(CON_TIME_OUT_MILLIS);
conn.setReadTimeout(TIME_OUT_MILLIS); conn.setReadTimeout(READ_TIME_OUT_MILLIS);
conn.setRequestMethod(method); conn.setRequestMethod(method);
conn.setDoOutput(true); conn.setDoOutput(true);
if (StringUtils.isNotBlank(body)) { if (StringUtils.isNotBlank(body)) {