fix: 修复blackList变量命名歧义并添加线程安全保护

- 将变量名从blackList改为blocklist,消除命名歧义
- 在extensionBlocklist_.emplace处添加mutex锁保护
- 添加break语句避免不必要的循环

Signed-off-by: zhang_hao_zheng <zhanghaozheng2@h-partners.com>
This commit is contained in:
zhang_hao_zheng
2026-01-29 11:26:21 +08:00
parent e2bf77ecb5
commit fd5668e508
@@ -68,16 +68,18 @@ void ExtensionConfigMgr::LoadExtensionBlockList(const std::string &extensionName
if (item.key() != extensionName) {
continue;
}
if (!blackList[item.key()].is_array()) {
if (!blocklist[item.key()].is_array()) {
continue;
}
for (const auto& value : blackList[item.key()]) {
for (const auto& value : blocklist[item.key()]) {
if (value.is_string()) {
currentBlockList.emplace(value.get<std::string>());
}
}
std::lock_guard<std::mutex> lock(extensionBlockListMutex_);
extensionBlocklist_.emplace(type, std::move(currentBlockList));
currentBlockList.clear();
break;
}
inFile.close();
}