|
@@ -236,13 +236,15 @@ public:
|
|
|
}
|
|
|
void LogToSender(Link_private* msg)
|
|
|
{
|
|
|
+
|
|
|
m_mtx.lock();
|
|
|
m_msgArr.push_back(*msg);
|
|
|
m_mtx.unlock();
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
- bool InitSender(std::string t_endpoint, std::string t_topic)
|
|
|
+ void InitSender(std::string t_endpoint, std::string t_topic)
|
|
|
{
|
|
|
+
|
|
|
auto skyeye_sender = [this](std::string t_endpoint, std::string t_topic) {
|
|
|
while (true)
|
|
|
{
|
|
@@ -262,7 +264,7 @@ public:
|
|
|
m_mtx.unlock();
|
|
|
|
|
|
if (sendArr.size() == 0)
|
|
|
- return; //no need to send
|
|
|
+ continue; //no need to send
|
|
|
|
|
|
//generate send str
|
|
|
Json::Value root;
|
|
@@ -290,7 +292,7 @@ public:
|
|
|
}
|
|
|
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
std::thread(skyeye_sender, t_endpoint, t_topic).detach();
|
|
|
}
|
|
|
|
|
@@ -492,10 +494,13 @@ void CreateDefaultLogger(std::string terminalno, std::string version, std::strin
|
|
|
constParam.m_cmptName = SpDefine::CmptName;
|
|
|
constParam.m_serviceUnitId = SpDefine::serviceUnitId;
|
|
|
constParam.m_deployUnitId = SpDefine::deployUnitId;
|
|
|
-
|
|
|
+ //std::this_thread::sleep_for(std::chrono::seconds(10));//every 30 seconds
|
|
|
skyeye_logger::getDefaultLogger().m_constParam = constParam;
|
|
|
TokenManager::getInstance().InitTokenManager(30, SpDefine::CommonLaunchUrl, SpDefine::channelId, SpDefine::tokenSecret, constParam.m_terminalNo, constParam.m_version);
|
|
|
- skyeye_sender::getInstance().InitSender(SpDefine::endpoint_env, SpDefine::topicSys);
|
|
|
+ //skyeye_sender::getInstance();
|
|
|
+ std::string endpoint = SpDefine::endpoint_env;
|
|
|
+ std::string topic = SpDefine::topicSys;
|
|
|
+ skyeye_sender::getInstance().InitSender(endpoint, topic);
|
|
|
|
|
|
}
|
|
|
|