fix: replace unsafe env::set_var with thread-safe OnceLock

Resolves intermittent STATUS_HEAP_CORRUPTION on Windows by using a static OnceLock map instead of mutating the global OS environment block.
This commit is contained in:
Riz Ashraf committed 2026-10-11 06:56:24 +01:00
1 parent 3533c243d2
commit ffb316a6e3
12 files changed
+235 -52

No files matched your search

+1 -1
View File
@@ -235,7 +235,7 @@ impl MemoryState {
pub fn modify_graph<F: FnOnce(&mut KnowledgeGraph)>(&self, update_fn: F) {
self.graph.modify(update_fn);
let threshold: usize = std::env::var("MCP_MEMORY_CONDENSE_THRESHOLD")
let threshold: usize = crate::config::get_env("MCP_MEMORY_CONDENSE_THRESHOLD")
.unwrap_or_else(|_| "100".to_string())
.parse()
.unwrap_or(100);