read ratio from swap-ratio
This commit is contained in:
@@ -166,7 +166,12 @@ function getMemory(callback) {
|
||||
}
|
||||
|
||||
function getMemoryAllocation(limit) {
|
||||
const pc = os.totalmem() / (os.totalmem() + getSwapSize());
|
||||
const ratio = Math.round(pc * 10) / 10; // a simple ratio
|
||||
let ratio = parseFloat(safe.fs.readFileSync(paths.SWAP_RATIO_FILE, 'utf8'), 10);
|
||||
|
||||
if (!ratio) {
|
||||
const pc = os.totalmem() / (os.totalmem() + getSwapSize());
|
||||
ratio = Math.round(pc * 10) / 10; // a simple ratio
|
||||
}
|
||||
|
||||
return Math.round(Math.round(limit * ratio) / 1048576) * 1048576; // nearest MB
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user