File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -460,8 +460,10 @@ def __enter__(self):
460460 meminfo = self .read_from_meminfo ()
461461 mem_total_in_bytes = meminfo ["MemTotal" ] * SWAPAllocator .KiB_TO_BYTES_FACTOR
462462 mem_avail_in_bytes = meminfo ["MemAvailable" ] * SWAPAllocator .KiB_TO_BYTES_FACTOR
463- if (mem_total_in_bytes < self .total_mem_threshold * SWAPAllocator .MiB_TO_BYTES_FACTOR
464- or mem_avail_in_bytes < self .available_mem_threshold * SWAPAllocator .MiB_TO_BYTES_FACTOR ):
463+ swap_total_in_bytes = meminfo ["SwapTotal" ] * SWAPAllocator .KiB_TO_BYTES_FACTOR
464+ swap_free_in_bytes = meminfo ["SwapFree" ] * SWAPAllocator .KiB_TO_BYTES_FACTOR
465+ if (mem_total_in_bytes + swap_total_in_bytes < self .total_mem_threshold * SWAPAllocator .MiB_TO_BYTES_FACTOR
466+ or mem_avail_in_bytes + swap_free_in_bytes < self .available_mem_threshold * SWAPAllocator .MiB_TO_BYTES_FACTOR ):
465467 echo_and_log ("Setup SWAP memory" )
466468 swapfile = SWAPAllocator .SWAP_FILE_PATH
467469 if os .path .exists (swapfile ):
You can’t perform that action at this time.
0 commit comments