Skip to content

Commit

Permalink
Rename oom_disabled to oom_killer to match panel (#25)
Browse files Browse the repository at this point in the history
* rename `oom_disabled` to `oom_killer`

* fix pointer mess
  • Loading branch information
Boy132 authored Jul 17, 2024
1 parent db2d1c3 commit 7d61055
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions environment/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type Limits struct {
// Sets which CPU threads can be used by the docker instance.
Threads string `json:"threads"`

OOMDisabled bool `json:"oom_disabled"`
OOMKiller bool `json:"oom_killer"`
}

// ConvertedCpuLimit converts the CPU limit for a server build into a number
Expand Down Expand Up @@ -99,6 +99,11 @@ func (l Limits) ProcessLimit() int64 {
return config.Get().Docker.ContainerPidLimit
}

// Helper function to create a pointer to a boolean value
func boolPtr(b bool) *bool {
return &b
}

// AsContainerResources returns the available resources for a container in a format
// that Docker understands.
func (l Limits) AsContainerResources() container.Resources {
Expand All @@ -108,7 +113,7 @@ func (l Limits) AsContainerResources() container.Resources {
MemoryReservation: l.MemoryLimit * 1_000_000,
MemorySwap: l.ConvertedSwap(),
BlkioWeight: l.IoWeight,
OomKillDisable: &l.OOMDisabled,
OomKillDisable: boolPtr(!l.OOMKiller),
PidsLimit: &pids,
}

Expand Down

0 comments on commit 7d61055

Please sign in to comment.