소스 검색

#IQRV #comment wait 20s in normal startup progress

chenliangyu 1 년 전
부모
커밋
57391bf919

+ 1 - 1
Framework/Common/SpBase.h

@@ -1620,7 +1620,7 @@ SPBASE_API void* create_log_producer_storage(CSimpleStringA entityName, CSimpleS
 SPBASE_API void destroy_log_producer_storage(void* obj);
 //创建日志上传模块,通常由spshell自动创建,然后上传
 SPBASE_API void* create_log_producer_send(CSimpleStringA endpoint, CSimpleStringA topicSys, CSimpleStringA topicUser, CSimpleStringA topicBeidou, CSimpleStringA bussinessSys, CSimpleStringA bussinessUser,
-	CSimpleStringA terminalNo, CSimpleStringA sn, CSimpleStringA filePath);
+	CSimpleStringA terminalNo, CSimpleStringA sn, CSimpleStringA filePath, int sendWaitTime);
 SPBASE_API void destroy_log_producer_send();
 //创建实体日志默认上传模块, SpShell 和 SpRun 中调用,内部调用 create_log_producer_storage
 SPBASE_API bool create_log_producer_default(CSimpleStringA entityName, int idx);

+ 5 - 0
Framework/RvcLogSdk/log_producer_config.c

@@ -31,6 +31,7 @@ static void _set_default_producer_config(log_producer_config* pConfig)
     pConfig->tokenFun = NULL;
 
     pConfig->sendThreadCount = 2;
+    pConfig->sendThreadWaitMs = 100;
 
     pConfig->logBytesPerPackage = MAX_LOG_COUNT * 1024;
     pConfig->logCountPerPackage = 5;
@@ -354,6 +355,10 @@ LOG_EXPORT void log_producer_config_set_dbgFun(dbg_callback t_callback)
     g_callback = t_callback;
 }
 
+void log_producer_config_set_send_thread_wait_ms(log_producer_config* config, int32_t ts)
+{
+    config->sendThreadWaitMs = ts;
+}
 
 void log_producer_config_set_endpoint(log_producer_config* config, const char* endpoint)
 {

+ 3 - 0
Framework/RvcLogSdk/log_producer_config.h

@@ -41,6 +41,7 @@ typedef struct _log_producer_config
     char* business_sys_topic;
 
     int32_t sendThreadCount;
+    int32_t sendThreadWaitMs;
 
     int32_t logCountPerPackage;
     int32_t logBytesPerPackage;
@@ -145,6 +146,8 @@ extern dbg_callback g_callback;
 // 日志回调函数
 LOG_EXPORT void log_producer_config_set_dbgFun(dbg_callback t_callback);
 
+LOG_EXPORT void log_producer_config_set_send_thread_wait_ms(log_producer_config* config, int32_t ts);
+
 /**
  * set producer config endpoint
  * @note if endpoint start with "https", then set using_https 1

+ 1 - 1
Framework/RvcLogSdk/log_producer_sender.c

@@ -113,7 +113,7 @@ void * log_producer_send_thread(void * param)
     {
         return 0;
     }
-
+    Sleep(producer_manager->producer_config->sendThreadWaitMs);
     while (!producer_manager->shutdown)
     {
         // change from 30ms to 1000ms, reduce wake up when app switch to back

+ 4 - 3
Framework/spbase/sp_logwithlink.cpp

@@ -579,7 +579,7 @@ SPBASE_API void* create_log_producer_storage(CSimpleStringA entityName, CSimpleS
     log_producer_config_set_packet_log_count(config, 24);//最大发送条数
     log_producer_config_set_max_buffer_limit(config, 64 * 1024 * 1024);
     // set send thread count
-    log_producer_config_set_send_thread_count(config, 2);
+    log_producer_config_set_send_thread_count(config, 1);
     log_producer_config_set_persistent_max_log_count(config, 50 * 1000);
     log_producer_config_set_skyeye_servname(config, (char*)"Terminal");
     log_producer_config_set_skyeye_cmptId(config, (char*)"LR04");
@@ -650,7 +650,7 @@ SPBASE_API void destroy_log_producer_storage(void* obj)
 }
 
 SPBASE_API void* create_log_producer_send(CSimpleStringA endpoint, CSimpleStringA topicSys, CSimpleStringA topicUser, CSimpleStringA topicBeidou, CSimpleStringA bussinessSys, CSimpleStringA bussinessUser,
-    CSimpleStringA terminalNo, CSimpleStringA sn, CSimpleStringA filePath)
+    CSimpleStringA terminalNo, CSimpleStringA sn, CSimpleStringA filePath, int sendWaitTime)
 {
 #ifndef _WIN32
     if (NULL != g_logProduceSender) {
@@ -659,6 +659,7 @@ SPBASE_API void* create_log_producer_send(CSimpleStringA endpoint, CSimpleString
 #endif
     log_producer_config* config = create_log_producer_config();
     log_producer_config_set_endpoint(config, endpoint.GetData());
+    log_producer_config_set_send_thread_wait_ms(config, sendWaitTime);
     // add topic, comment it
     log_producer_config_set_beidou_topic(config, topicBeidou.GetData());
     log_producer_config_set_skyeye_user_topic(config, topicUser.GetData());
@@ -671,7 +672,7 @@ SPBASE_API void* create_log_producer_send(CSimpleStringA endpoint, CSimpleString
     log_producer_config_set_packet_log_count(config, 24);
     log_producer_config_set_max_buffer_limit(config, 64 * 1024 * 1024);
     // set send thread count
-    log_producer_config_set_send_thread_count(config, 2);
+    log_producer_config_set_send_thread_count(config, 1);
     log_producer_config_set_persistent_max_log_count(config, 50 * 1000);
     log_producer_config_set_skyeye_servname(config, (char*)"Terminal");
     log_producer_config_set_skyeye_cmptId(config, (char*)"LR04");

+ 1 - 1
Framework/spshell/app.cpp

@@ -873,5 +873,5 @@ void app_upload_last_log()
     const char* topicBussSys = "LR18_23_VTMTerminalLogService_L_sys_VTMBusiness_SRC_SZ";
     const char* topicBussUser = "LR18_23_VTMTerminalLogService_L_biz_VTMBusiness_SRC_SZ";
 
-    create_log_producer_send(endpoint, topicSys, topicUser, topicBeidou, topicBussSys, topicBussUser, t_terminalNo, t_terminalNo, "");
+    create_log_producer_send(endpoint, topicSys, topicUser, topicBeidou, topicBussSys, topicBussUser, t_terminalNo, t_terminalNo, "", 100);
 }

+ 1 - 1
Framework/spshell/svc.cpp

@@ -571,7 +571,7 @@ void on_start_upload_log(sp_rpc_server_t* server, int epid, int svc_id, int call
 	char *endpoint = NULL, *topicSys = NULL, *topicUser = NULL, *topicBeidou = NULL, *bussSys = NULL, *bussUser = NULL;
 	iobuffer_format_read(*info_pkt, "ssssss", &endpoint, &topicSys, &topicUser, &topicBeidou, &bussSys, &bussUser);
 	
-	auto logSender = create_log_producer_send(endpoint, topicSys, topicUser, topicBeidou, bussSys, bussUser, env->cfg->root_ini->terminal_no, env->cfg->root_ini->terminal_no, "");
+	auto logSender = create_log_producer_send(endpoint, topicSys, topicUser, topicBeidou, bussSys, bussUser, env->cfg->root_ini->terminal_no, env->cfg->root_ini->terminal_no, "", 20000);
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("create log produce sender %s-%s-%s-%s-%s-%s %s", endpoint, topicSys, topicUser, topicBeidou, bussSys, bussUser, logSender == NULL ? "failed" : "success");
 	toolkit_free(endpoint);
 	toolkit_free(topicSys);

+ 1 - 1
Other/liblog4rvcother/log4upload.cpp

@@ -190,7 +190,7 @@ bool upload_helper::initialize(const cmb::log_init_config& cfg)
         pinst_log_producer_config_set_packet_log_count(config, 24);//最大发送条数
         pinst_log_producer_config_set_max_buffer_limit(config, 64 * 1024 * 1024);
         //set send thread count
-        pinst_log_producer_config_set_send_thread_count(config, 2);
+        pinst_log_producer_config_set_send_thread_count(config, 1);
         pinst_log_producer_config_set_persistent_max_log_count(config, 50 * 1000);
         pinst_log_producer_config_set_skyeye_servname(config, (char*)"Terminal");
         pinst_log_producer_config_set_skyeye_cmptId(config, (char*)"LR04");

+ 1 - 1
Other/liblog4vendor/log4upload.cpp

@@ -190,7 +190,7 @@ bool upload_helper::initialize(const cmb::log_init_config& cfg)
         pinst_log_producer_config_set_packet_log_count(config, 24);//最大发送条数
         pinst_log_producer_config_set_max_buffer_limit(config, 64 * 1024 * 1024);
         //set send thread count
-        pinst_log_producer_config_set_send_thread_count(config, 2);
+        pinst_log_producer_config_set_send_thread_count(config, 1);
         pinst_log_producer_config_set_persistent_max_log_count(config, 50 * 1000);
         pinst_log_producer_config_set_skyeye_servname(config, (char*)"Terminal");
         pinst_log_producer_config_set_skyeye_cmptId(config, (char*)"LR04");