Skip to content

Commit 7dae82d

Browse files
chore: remove automaxprocs (argoproj#24164)
Signed-off-by: Blake Pettersson <[email protected]>
1 parent 0984b03 commit 7dae82d

File tree

5 files changed

+0
-47
lines changed

5 files changed

+0
-47
lines changed

cmd/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
reposerver "github.com/argoproj/argo-cd/v3/cmd/argocd-repo-server/commands"
2121
apiserver "github.com/argoproj/argo-cd/v3/cmd/argocd-server/commands"
2222
cli "github.com/argoproj/argo-cd/v3/cmd/argocd/commands"
23-
"github.com/argoproj/argo-cd/v3/cmd/util"
2423
"github.com/argoproj/argo-cd/v3/util/log"
2524
)
2625

@@ -74,7 +73,6 @@ func main() {
7473
command = cli.NewCommand()
7574
isArgocdCLI = true
7675
}
77-
util.SetAutoMaxProcs(isArgocdCLI)
7876

7977
if isArgocdCLI {
8078
// silence errors and usages since we'll be printing them manually.

cmd/util/app.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import (
1010
"strings"
1111
"time"
1212

13-
"go.uber.org/automaxprocs/maxprocs"
14-
1513
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1614

1715
"github.com/argoproj/gitops-engine/pkg/utils/kube"
@@ -102,19 +100,6 @@ type AppOptions struct {
102100
hydrateToBranch string
103101
}
104102

105-
// SetAutoMaxProcs sets the GOMAXPROCS value based on the binary name.
106-
// It suppresses logs for CLI binaries and logs the setting for services.
107-
func SetAutoMaxProcs(isCLI bool) {
108-
if isCLI {
109-
_, _ = maxprocs.Set() // Intentionally ignore errors for CLI binaries
110-
} else {
111-
_, err := maxprocs.Set(maxprocs.Logger(log.Infof))
112-
if err != nil {
113-
log.Errorf("Error setting GOMAXPROCS: %v", err)
114-
}
115-
}
116-
}
117-
118103
func AddAppFlags(command *cobra.Command, opts *AppOptions) {
119104
command.Flags().StringVar(&opts.repoURL, "repo", "", "Repository URL, ignored if a file is set")
120105
command.Flags().StringVar(&opts.appPath, "path", "", "Path in repository to the app directory, ignored if a file is set")

cmd/util/app_test.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package util
22

33
import (
4-
"bytes"
54
"log"
65
"os"
76
"testing"
@@ -573,27 +572,3 @@ func TestFilterResources(t *testing.T) {
573572
assert.Nil(t, filteredResources)
574573
})
575574
}
576-
577-
func TestSetAutoMaxProcs(t *testing.T) {
578-
t.Run("CLI mode ignores errors", func(t *testing.T) {
579-
logBuffer := &bytes.Buffer{}
580-
oldLogger := log.Default()
581-
log.SetOutput(logBuffer)
582-
defer log.SetOutput(oldLogger.Writer())
583-
584-
SetAutoMaxProcs(true)
585-
586-
assert.Empty(t, logBuffer.String(), "Expected no log output when isCLI is true")
587-
})
588-
589-
t.Run("Non-CLI mode logs error on failure", func(t *testing.T) {
590-
logBuffer := &bytes.Buffer{}
591-
oldLogger := log.Default()
592-
log.SetOutput(logBuffer)
593-
defer log.SetOutput(oldLogger.Writer())
594-
595-
SetAutoMaxProcs(false)
596-
597-
assert.NotContains(t, logBuffer.String(), "Error setting GOMAXPROCS", "Unexpected log output detected")
598-
})
599-
}

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ require (
9090
go.opentelemetry.io/otel v1.36.0
9191
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.36.0
9292
go.opentelemetry.io/otel/sdk v1.36.0
93-
go.uber.org/automaxprocs v1.6.0
9493
golang.org/x/crypto v0.41.0
9594
golang.org/x/net v0.43.0
9695
golang.org/x/oauth2 v0.30.0

go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
765765
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
766766
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
767767
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
768-
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
769-
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
770768
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
771769
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
772770
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
@@ -931,8 +929,6 @@ go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2
931929
go.opentelemetry.io/proto/otlp v1.6.0 h1:jQjP+AQyTf+Fe7OKj/MfkDrmK4MNVtw2NpXsf9fefDI=
932930
go.opentelemetry.io/proto/otlp v1.6.0/go.mod h1:cicgGehlFuNdgZkcALOCh3VE6K/u2tAjzlRhDwmVpZc=
933931
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
934-
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
935-
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
936932
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
937933
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
938934
go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko=

0 commit comments

Comments
 (0)