diff --git a/environment/settings.go b/environment/settings.go index def91f62..1d57154e 100644 --- a/environment/settings.go +++ b/environment/settings.go @@ -34,7 +34,7 @@ type Mount struct { // Limits is the build settings for a given server that impact docker container // creation and resource limits for a server instance. type Limits struct { - // The total amount of memory in megabytes that this server is allowed to + // The total amount of memory in mebibytes that this server is allowed to // use on the host system. MemoryLimit int64 `json:"memory_limit"` @@ -79,7 +79,7 @@ func (l Limits) MemoryOverheadMultiplier() float64 { } func (l Limits) BoundedMemoryLimit() int64 { - return int64(math.Round(float64(l.MemoryLimit) * l.MemoryOverheadMultiplier() * 1_000_000)) + return int64(math.Round(float64(l.MemoryLimit) * l.MemoryOverheadMultiplier() * 1024 * 1024)) } // ConvertedSwap returns the amount of swap available as a total in bytes. This @@ -90,7 +90,7 @@ func (l Limits) ConvertedSwap() int64 { return -1 } - return (l.Swap * 1_000_000) + l.BoundedMemoryLimit() + return (l.Swap * 1024 * 1024) + l.BoundedMemoryLimit() } // ProcessLimit returns the process limit for a container. This is currently @@ -105,7 +105,7 @@ func (l Limits) AsContainerResources() container.Resources { pids := l.ProcessLimit() resources := container.Resources{ Memory: l.BoundedMemoryLimit(), - MemoryReservation: l.MemoryLimit * 1_000_000, + MemoryReservation: l.MemoryLimit * 1024 * 1024, MemorySwap: l.ConvertedSwap(), BlkioWeight: l.IoWeight, OomKillDisable: &l.OOMDisabled,