1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-01-20 18:52:16 +00:00
kyverno/cmd/internal/maxprocs.go

25 lines
462 B
Go
Raw Normal View History

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
}