diff --git a/fn/concurrency.go b/fn/concurrency.go index 5ff80e7bf..6c899989d 100644 --- a/fn/concurrency.go +++ b/fn/concurrency.go @@ -23,7 +23,7 @@ type ErrFunc[V any] func(context.Context, V) error // non-nil error (if any). func ParSlice[V any](ctx context.Context, s []V, f ErrFunc[V]) error { errGroup, ctx := errgroup.WithContext(ctx) - errGroup.SetLimit(runtime.NumCPU()) + errGroup.SetLimit(runtime.GOMAXPROCS(0)) for _, v := range s { v := v @@ -44,7 +44,7 @@ func ParSliceErrCollect[V any](ctx context.Context, s []V, f ErrFunc[V]) (map[int]error, error) { errGroup, ctx := errgroup.WithContext(ctx) - errGroup.SetLimit(runtime.NumCPU()) + errGroup.SetLimit(runtime.GOMAXPROCS(0)) var instanceErrorsMutex sync.Mutex instanceErrors := make(map[int]error, len(s)) diff --git a/proof/verifier.go b/proof/verifier.go index be320f1c6..271e165ed 100644 --- a/proof/verifier.go +++ b/proof/verifier.go @@ -266,7 +266,7 @@ func (p *Proof) verifyAssetStateTransition(ctx context.Context, // bail out as soon as any of the active goroutines encounters an // error. errGroup, ctx := errgroup.WithContext(ctx) - errGroup.SetLimit(runtime.NumCPU()) + errGroup.SetLimit(runtime.GOMAXPROCS(0)) var assetsMtx sync.Mutex for _, inputProof := range p.AdditionalInputs {