From 33d4d63acd6e43f052f0b0181e63afe32885d709 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Tue, 30 Apr 2024 13:27:19 +0200 Subject: [PATCH] Adds a warning on max-cpu = 1 Former-commit-id: ed02328d7d0e36b7c6b77ea776c0bde7c0eb64f3 --- pkg/obioptions/options.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/obioptions/options.go b/pkg/obioptions/options.go index 24a4d60..ce9b180 100644 --- a/pkg/obioptions/options.go +++ b/pkg/obioptions/options.go @@ -88,7 +88,12 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser } // Setup the maximum number of CPU usable by the program - runtime.GOMAXPROCS(_MaxAllowedCPU) + if _MaxAllowedCPU == 1 { + log.Warn("Limitating the Maximum number of CPU to 1 is not recommanded") + runtime.GOMAXPROCS(1) + } else { + runtime.GOMAXPROCS(_MaxAllowedCPU) + } if options.Called("max-cpu") { log.Printf("CPU number limited to %d", _MaxAllowedCPU) }