修改编译脚本适配pqdif,同步61850日志上送逻辑
This commit is contained in:
@@ -236,6 +236,14 @@ int TEST_PORT = 11000; //用于当前进程登录测试shell的端口
|
||||
std::string G_TEST_LIST = ""; //测试用的发送实际数据的终端列表
|
||||
std::vector<std::string> TESTARRAY; //解析的列表数组
|
||||
|
||||
// 日志限流配置
|
||||
int G_LOG_RATE_RESET_SEC = 3600; // 1小时重置
|
||||
int G_LOG_RATE_LIMIT_SEC = 60; // 进入限流后:60秒1条
|
||||
int G_LOG_RATE_KEEP_ALL_MS = 60000; // 间隔 >= 60000ms,全部保留
|
||||
int G_LOG_RATE_KEEP_BURST_MS = 1000; // 间隔 >= 1000ms,按二级策略
|
||||
int G_LOG_RATE_KEEP_BURST_COUNT = 60; // 二级保留前60条
|
||||
int G_LOG_RATE_KEEP_HIGHFREQ_COUNT = 10; // 高频保留前10条
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////其他文件定义的函数引用声明
|
||||
|
||||
bool enqueue_direct_download(const std::string& dev_id,
|
||||
@@ -413,6 +421,37 @@ void loadConfig(const std::string& filename) {
|
||||
intMap["RocketMq.TestPort"] = &TEST_PORT;
|
||||
strMap["RocketMq.TestList"] = &G_TEST_LIST;
|
||||
|
||||
// ==================== 新增:日志限流配置 ====================
|
||||
intMap["LogRate.ResetSec"] = &G_LOG_RATE_RESET_SEC;
|
||||
intMap["LogRate.LimitSec"] = &G_LOG_RATE_LIMIT_SEC;
|
||||
intMap["LogRate.KeepAllMs"] = &G_LOG_RATE_KEEP_ALL_MS;
|
||||
intMap["LogRate.KeepBurstMs"] = &G_LOG_RATE_KEEP_BURST_MS;
|
||||
intMap["LogRate.KeepBurstCount"] = &G_LOG_RATE_KEEP_BURST_COUNT;
|
||||
intMap["LogRate.KeepHighFreqCount"] = &G_LOG_RATE_KEEP_HIGHFREQ_COUNT;
|
||||
// ==========================================================
|
||||
|
||||
// ==================== 新增:日志限流默认值保护 ====================
|
||||
|
||||
if (G_LOG_RATE_RESET_SEC <= 0)
|
||||
G_LOG_RATE_RESET_SEC = 3600;
|
||||
|
||||
if (G_LOG_RATE_LIMIT_SEC <= 0)
|
||||
G_LOG_RATE_LIMIT_SEC = 60;
|
||||
|
||||
if (G_LOG_RATE_KEEP_ALL_MS <= 0)
|
||||
G_LOG_RATE_KEEP_ALL_MS = 60000;
|
||||
|
||||
if (G_LOG_RATE_KEEP_BURST_MS <= 0)
|
||||
G_LOG_RATE_KEEP_BURST_MS = 1000;
|
||||
|
||||
if (G_LOG_RATE_KEEP_BURST_COUNT < 0)
|
||||
G_LOG_RATE_KEEP_BURST_COUNT = 60;
|
||||
|
||||
if (G_LOG_RATE_KEEP_HIGHFREQ_COUNT < 0)
|
||||
G_LOG_RATE_KEEP_HIGHFREQ_COUNT = 10;
|
||||
|
||||
// ================================================================
|
||||
|
||||
// 2. 打开并逐行解析 INI 文件
|
||||
std::ifstream fin(filename);
|
||||
if (!fin.is_open()) {
|
||||
@@ -585,6 +624,15 @@ void printConfig() {
|
||||
printStr("WEB_FILEUPLOAD", WEB_FILEUPLOAD);
|
||||
printStr("WEB_FILEDOWNLOAD", WEB_FILEDOWNLOAD);
|
||||
|
||||
std::cout << "\n// 日志限流配置\n";
|
||||
|
||||
printInt("G_LOG_RATE_RESET_SEC", G_LOG_RATE_RESET_SEC);
|
||||
printInt("G_LOG_RATE_LIMIT_SEC", G_LOG_RATE_LIMIT_SEC);
|
||||
printInt("G_LOG_RATE_KEEP_ALL_MS", G_LOG_RATE_KEEP_ALL_MS);
|
||||
printInt("G_LOG_RATE_KEEP_BURST_MS", G_LOG_RATE_KEEP_BURST_MS);
|
||||
printInt("G_LOG_RATE_KEEP_BURST_COUNT", G_LOG_RATE_KEEP_BURST_COUNT);
|
||||
printInt("G_LOG_RATE_KEEP_HIGHFREQ_COUNT",G_LOG_RATE_KEEP_HIGHFREQ_COUNT);
|
||||
|
||||
std::cout << "-------------------------------------\n";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user