Skip to content

Commit

Permalink
add automaxprocs to default GOMAXPROCS to be CPU limit aware
Browse files Browse the repository at this point in the history
this implementation does NOT log unlike importing the root automaxprocs package
  • Loading branch information
BenTheElder committed May 17, 2023
1 parent 0106cf1 commit 241fe83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ require (
github.com/tdewolff/parse/v2 v2.6.5
github.com/yuin/goldmark v1.5.4
go.uber.org/atomic v1.10.0
go.uber.org/automaxprocs v1.5.2
gocloud.dev v0.24.0
golang.org/x/exp v0.0.0-20221031165847-c99f073a8326
golang.org/x/image v0.5.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/automaxprocs v1.5.2 h1:2LxUOGiR3O6tw8ui5sZa2LAaHnsviZdVOUZw4fvbnME=
go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ import (
"log"
"os"

"go.uber.org/automaxprocs/maxprocs"

"github.com/gohugoio/hugo/commands"
)

func main() {
// default GOMAXPROCS to be CPU limit aware, still respecting GOMAXPROCS env
maxprocs.Set()
err := commands.Execute(os.Args[1:])
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 241fe83

Please sign in to comment.