You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2023/09/13 08:09:39 UTC

[inlong] branch master updated: [INLONG-8910][SDK] Adjust default configuration parameters (#8911)

This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b5edd5186 [INLONG-8910][SDK] Adjust default configuration parameters (#8911)
4b5edd5186 is described below

commit 4b5edd518616f1154514b9afe66a2334bc36ffb9
Author: doleyzi <43...@users.noreply.github.com>
AuthorDate: Wed Sep 13 16:09:32 2023 +0800

    [INLONG-8910][SDK] Adjust default configuration parameters (#8911)
---
 .../dataproxy-sdk-twins/dataproxy-sdk-cpp/src/config/sdk_conf.cc      | 1 +
 .../dataproxy-sdk-twins/dataproxy-sdk-cpp/src/group/send_group.cc     | 2 ++
 .../dataproxy-sdk-cpp/src/manager/proxy_manager.cc                    | 2 ++
 .../dataproxy-sdk-twins/dataproxy-sdk-cpp/src/utils/capi_constant.h   | 2 +-
 inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/utils/utils.cc   | 4 ++--
 5 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/config/sdk_conf.cc b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/config/sdk_conf.cc
index b327e305e3..a4317dc764 100644
--- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/config/sdk_conf.cc
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/config/sdk_conf.cc
@@ -63,6 +63,7 @@ bool SdkConfig::ParseConfig(const std::string &config_path) {
   InitManagerParam(doc);
   InitTcpParam(doc);
   OthersParam(doc);
+  InitAuthParm(doc);
 
   inlong::initLog4cplus();
 
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/group/send_group.cc b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/group/send_group.cc
index b4d001caab..fb91972318 100644
--- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/group/send_group.cc
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/group/send_group.cc
@@ -155,6 +155,8 @@ void SendGroup::UpdateConf(std::error_code error) {
     return;
   }
 
+  std::random_shuffle(new_proxy_info.begin(), new_proxy_info.end());
+
   tcp_clients_tmp->reserve(proxy_num);
   for (int i = 0; i < proxy_num; i++) {
     ProxyInfo proxy_tmp = new_proxy_info[i];
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/manager/proxy_manager.cc b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/manager/proxy_manager.cc
index ea0b3f2ef5..5b5d13055a 100644
--- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/manager/proxy_manager.cc
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/manager/proxy_manager.cc
@@ -67,6 +67,8 @@ void ProxyManager::DoUpdate() {
   update_mutex_.try_lock();
   LOG_INFO("start ProxyManager DoUpdate.");
 
+  std::srand(unsigned(std::time(nullptr)));
+
   if (groupid_2_cluster_map_.empty()) {
     LOG_INFO("empty groupid, no need to DoUpdate proxy list");
     update_mutex_.unlock();
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/utils/capi_constant.h b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/utils/capi_constant.h
index 089bd0bca4..5e67dd9266 100644
--- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/utils/capi_constant.h
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/utils/capi_constant.h
@@ -63,7 +63,7 @@ static const char kManagerClusterURL[] =
     "dataproxy_ip_v2?cluster_id=0&net_tag=normal";
 static const uint32_t kManagerUpdateInterval = 2;
 static const uint32_t kManagerTimeout = 5;
-static const uint32_t kMaxProxyNum = 200;
+static const uint32_t kMaxProxyNum = 8;
 
 static const bool kEnableTCPNagle = true;
 static const uint32_t kTcpIdleTime = 600000;
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/utils/utils.cc b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/utils/utils.cc
index 5fd060a07a..b3856b440b 100644
--- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/utils/utils.cc
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/utils/utils.cc
@@ -445,7 +445,7 @@ int32_t Utils::requestUrl(std::string &res, const HttpRequest *request) {
   CURLcode ret = curl_easy_perform(curl);
   if (ret != 0) {
     LOG_ERROR(curl_easy_strerror(ret));
-    LOG_ERROR("failed to request data from %s" << request->url.c_str());
+    LOG_ERROR("failed to request data from " << request->url.c_str());
     if (curl)
       curl_easy_cleanup(curl);
     curl_global_cleanup();
@@ -456,7 +456,7 @@ int32_t Utils::requestUrl(std::string &res, const HttpRequest *request) {
   int32_t code;
   curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code);
   if (code != 200) {
-    LOG_ERROR("tdm responsed with code %d" << code);
+    LOG_ERROR("tdm responsed with code " << code);
     if (curl)
       curl_easy_cleanup(curl);
     curl_global_cleanup();