Ensure we never set more memory than swap for containers
This commit is contained in:
@@ -219,7 +219,10 @@ async function getMemoryAllocation(limit) {
|
||||
ratio = Math.round(pc * 10) / 10; // a simple ratio
|
||||
}
|
||||
|
||||
return Math.round(Math.round(limit * ratio) / 1048576) * 1048576; // nearest MB
|
||||
const memoryAllocation = Math.round(Math.round(limit * ratio) / 1048576) * 1048576; // nearest MB
|
||||
|
||||
// make sure we never overshoot if the ratio is quite far off (high RAM low swap)
|
||||
return memoryAllocation > limit ? limit : memoryAllocation;
|
||||
}
|
||||
|
||||
async function getDiskUsage() {
|
||||
|
||||
Reference in New Issue
Block a user