Skip to content

Commit 3f4b50d

Browse files
committed
chore: backup GOMAXPROCS
1 parent 4fa63cc commit 3f4b50d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/commands/run.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,13 @@ func (c *runCommand) persistentPreRunE(cmd *cobra.Command, _ []string) error {
159159
}
160160

161161
if c.cfg.Run.Concurrency == 0 {
162+
backup := runtime.GOMAXPROCS(0)
163+
162164
// Automatically set GOMAXPROCS to match Linux container CPU quota.
163-
_, _ = maxprocs.Set(maxprocs.Logger(c.log.Infof))
165+
_, err := maxprocs.Set(maxprocs.Logger(c.log.Infof))
166+
if err != nil {
167+
runtime.GOMAXPROCS(backup)
168+
}
164169
} else {
165170
runtime.GOMAXPROCS(c.cfg.Run.Concurrency)
166171
}

0 commit comments

Comments
 (0)