mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
6de0b8461f
* 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>
24 lines
462 B
Go
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
|
|
}
|