1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-15 17:51:20 +00:00
kyverno/cmd/internal/maxprocs.go
Charles-Edouard Brétéché 6de0b8461f
fix: make configuring max procs not exit in case of error (#7588)
* fix: make configuring max procs not exit

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-06-19 16:27:00 +00:00

24 lines
462 B
Go

package internal
import (
"fmt"
"github.com/go-logr/logr"
"go.uber.org/automaxprocs/maxprocs"
)
func setupMaxProcs(logger logr.Logger) func() {
logger = logger.WithName("maxprocs")
logger.Info("setup maxprocs...")
undo, err := maxprocs.Set(
maxprocs.Logger(
func(format string, args ...interface{}) {
logger.Info(fmt.Sprintf(format, args...))
},
),
)
if err != nil {
logger.Error(err, "failed to configure maxprocs")
}
return undo
}