multi front process
This commit is contained in:
@@ -527,7 +527,7 @@ void init_config() {
|
||||
}
|
||||
|
||||
//测试进程端口
|
||||
if (g_node_id == STAT_DATA_BASE_NODE_ID)//统计采集
|
||||
/*if (g_node_id == STAT_DATA_BASE_NODE_ID)//统计采集
|
||||
TEST_PORT = TEST_PORT + STAT_DATA_BASE_NODE_ID + g_front_seg_index;
|
||||
else if (g_node_id == RECALL_HIS_DATA_BASE_NODE_ID) {//补召
|
||||
TEST_PORT = TEST_PORT + RECALL_HIS_DATA_BASE_NODE_ID + g_front_seg_index;
|
||||
@@ -537,8 +537,8 @@ void init_config() {
|
||||
}
|
||||
else if (g_node_id == SOE_COMTRADE_BASE_NODE_ID) {//暂态录波
|
||||
TEST_PORT = TEST_PORT + SOE_COMTRADE_BASE_NODE_ID + g_front_seg_index;
|
||||
}
|
||||
|
||||
}*/
|
||||
TEST_PORT = TEST_PORT + g_front_seg_index;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////获取当前时间
|
||||
@@ -817,7 +817,7 @@ int parse_recall_xml(recall_xml_t* recall_xml, const std::string& id) {
|
||||
|
||||
DIR* dir = opendir(cfg_dir.c_str());
|
||||
if (!dir) {
|
||||
DIY_ERRORLOG("process", "【ERROR】前置的%s%d号进程 无法解析补招文件,补招文件路径FRONT_PATH + /etc/recall/不存在", get_front_msg_from_subdir(), g_front_seg_index);
|
||||
DIY_ERRORLOG("process", "【ERROR】前置的%d号进程 无法解析补招文件,补招文件路径FRONT_PATH + /etc/recall/不存在", g_front_seg_index);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -829,7 +829,7 @@ int parse_recall_xml(recall_xml_t* recall_xml, const std::string& id) {
|
||||
std::string filepath = cfg_dir + "/" + filename;
|
||||
tinyxml2::XMLDocument doc;
|
||||
if (doc.LoadFile(filepath.c_str()) != tinyxml2::XML_SUCCESS) {
|
||||
DIY_ERRORLOG("process", "【ERROR】前置的%s%d号进程 无法解析补招文件%s,补招内容无效", get_front_msg_from_subdir(), g_front_seg_index, filepath.c_str());
|
||||
DIY_ERRORLOG("process", "【ERROR】前置的%d号进程 无法解析补招文件%s,补招内容无效", g_front_seg_index, filepath.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -871,20 +871,18 @@ void process_recall_config(recall_xml_t* recall_xml)
|
||||
|
||||
//根据监测点id来获取补招数据,补招时调用这个
|
||||
void Check_Recall_Config(const std::string& id) {
|
||||
if (g_node_id == HIS_DATA_BASE_NODE_ID ||
|
||||
/*if (g_node_id == HIS_DATA_BASE_NODE_ID ||
|
||||
g_node_id == NEW_HIS_DATA_BASE_NODE_ID ||
|
||||
g_node_id == RECALL_HIS_DATA_BASE_NODE_ID ||
|
||||
g_node_id == RECALL_ALL_DATA_BASE_NODE_ID) {
|
||||
g_node_id == RECALL_ALL_DATA_BASE_NODE_ID) {*/
|
||||
|
||||
recall_xml_t recall_xml;
|
||||
std::memset(&recall_xml, 0, sizeof(recall_xml_t));
|
||||
|
||||
// 解析补招文件
|
||||
parse_recall_xml(&recall_xml, id);
|
||||
|
||||
// 将补招数据赋值到全局变量
|
||||
process_recall_config(&recall_xml);
|
||||
}
|
||||
recall_xml_t recall_xml;
|
||||
std::memset(&recall_xml, 0, sizeof(recall_xml_t));
|
||||
// 解析补招文件
|
||||
parse_recall_xml(&recall_xml, id);
|
||||
// 将补招数据赋值到全局变量
|
||||
process_recall_config(&recall_xml);
|
||||
//}
|
||||
}
|
||||
|
||||
//补招成功后删除补招文件,补招后调用这个
|
||||
@@ -925,7 +923,7 @@ void DeletcRecallXml() {
|
||||
DIR* dir = opendir(cfg_dir.c_str());
|
||||
if (!dir) {
|
||||
std::cerr << "folder does not exist!" << std::endl;
|
||||
DIY_ERRORLOG("process", "【ERROR】前置的%s%d号进程 删除旧的补招文件失败,补招文件路径FRONT_PATH + /etc/recall/不存在",get_front_msg_from_subdir(), g_front_seg_index);
|
||||
DIY_ERRORLOG("process", "【ERROR】前置的%d号进程 删除旧的补招文件失败,补招文件路径FRONT_PATH + /etc/recall/不存在", g_front_seg_index);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -944,7 +942,7 @@ void DeletcRecallXml() {
|
||||
if (stat(fullpath.c_str(), &file_stat) == 0) {
|
||||
if (file_stat.st_mtime < cutoff) {
|
||||
if (remove(fullpath.c_str()) == 0) {
|
||||
DIY_INFOLOG("process", "【NORMAL】前置的%s%d号进程 删除超过两天的补招文件",get_front_msg_from_subdir(), g_front_seg_index);
|
||||
DIY_INFOLOG("process", "【NORMAL】前置的%d号进程 删除超过两天的补招文件", g_front_seg_index);
|
||||
} else {
|
||||
std::cerr << "Failed to remove file: " << fullpath << std::endl;
|
||||
}
|
||||
@@ -966,7 +964,7 @@ void CreateRecallXml() {
|
||||
g_StatisticLackList_list_mutex.lock();
|
||||
|
||||
if (!g_StatisticLackList.empty()) {
|
||||
DIY_INFOLOG("process", "【NORMAL】前置的%s%d号进程 开始写入补招文件", get_front_msg_from_subdir(), g_front_seg_index);
|
||||
DIY_INFOLOG("process", "【NORMAL】前置的%d号进程 开始写入补招文件", g_front_seg_index);
|
||||
|
||||
std::map<std::string, std::list<JournalRecall>> id_map;
|
||||
for (const auto& jr : g_StatisticLackList) {
|
||||
@@ -1006,7 +1004,7 @@ void CreateRecallXml() {
|
||||
|
||||
tinyxml2::XMLError save_result = doc.SaveFile(path.str().c_str());
|
||||
if (save_result != tinyxml2::XML_SUCCESS) {
|
||||
DIY_ERRORLOG("process", "【ERROR】前置的%s%d号进程 无法将补招文件写入路径: %s",get_front_msg_from_subdir(), g_front_seg_index, path.str().c_str());
|
||||
DIY_ERRORLOG("process", "【ERROR】前置的%d号进程 无法将补招文件写入路径: %s", g_front_seg_index, path.str().c_str());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -1019,10 +1017,10 @@ void CreateRecallXml() {
|
||||
//生成待补招xml文件
|
||||
void create_recall_xml()
|
||||
{
|
||||
if (g_node_id == HIS_DATA_BASE_NODE_ID || g_node_id == NEW_HIS_DATA_BASE_NODE_ID || g_node_id == RECALL_HIS_DATA_BASE_NODE_ID || (g_node_id == RECALL_ALL_DATA_BASE_NODE_ID)) {
|
||||
DeletcRecallXml();
|
||||
CreateRecallXml();
|
||||
}
|
||||
//if (g_node_id == HIS_DATA_BASE_NODE_ID || g_node_id == NEW_HIS_DATA_BASE_NODE_ID || g_node_id == RECALL_HIS_DATA_BASE_NODE_ID || (g_node_id == RECALL_ALL_DATA_BASE_NODE_ID)) {
|
||||
DeletcRecallXml();
|
||||
CreateRecallXml();
|
||||
//}
|
||||
}
|
||||
|
||||
// 工具函数:将时间字符串转为 time_t(秒级)
|
||||
|
||||
Reference in New Issue
Block a user