mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-05 20:26:31 +00:00
Merge pull request #5729 from martin-g/5616-max-memory-in-container
Take into account the allowed max memory of the container
This commit is contained in:
@ -886,7 +886,10 @@ fn total_memory_bytes() -> Option<u64> {
|
|||||||
let mem_kind = RefreshKind::nothing().with_memory(MemoryRefreshKind::nothing().with_ram());
|
let mem_kind = RefreshKind::nothing().with_memory(MemoryRefreshKind::nothing().with_ram());
|
||||||
let mut system = System::new_with_specifics(mem_kind);
|
let mut system = System::new_with_specifics(mem_kind);
|
||||||
system.refresh_memory();
|
system.refresh_memory();
|
||||||
Some(system.total_memory())
|
system
|
||||||
|
.cgroup_limits()
|
||||||
|
.map(|limits| limits.total_memory)
|
||||||
|
.or_else(|| Some(system.total_memory()))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user