Skip to content

Commit 139bac2

Browse files
committed
fn+proof: use GOMAXPROCS for worker pool size
1 parent 2f0947d commit 139bac2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

fn/concurrency.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type ErrFunc[V any] func(context.Context, V) error
2323
// non-nil error (if any).
2424
func ParSlice[V any](ctx context.Context, s []V, f ErrFunc[V]) error {
2525
errGroup, ctx := errgroup.WithContext(ctx)
26-
errGroup.SetLimit(runtime.NumCPU())
26+
errGroup.SetLimit(runtime.GOMAXPROCS(0))
2727

2828
for _, v := range s {
2929
v := v
@@ -44,7 +44,7 @@ func ParSliceErrCollect[V any](ctx context.Context, s []V,
4444
f ErrFunc[V]) (map[int]error, error) {
4545

4646
errGroup, ctx := errgroup.WithContext(ctx)
47-
errGroup.SetLimit(runtime.NumCPU())
47+
errGroup.SetLimit(runtime.GOMAXPROCS(0))
4848

4949
var instanceErrorsMutex sync.Mutex
5050
instanceErrors := make(map[int]error, len(s))

proof/verifier.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ func (p *Proof) verifyAssetStateTransition(ctx context.Context,
266266
// bail out as soon as any of the active goroutines encounters an
267267
// error.
268268
errGroup, ctx := errgroup.WithContext(ctx)
269-
errGroup.SetLimit(runtime.NumCPU())
269+
errGroup.SetLimit(runtime.GOMAXPROCS(0))
270270

271271
var assetsMtx sync.Mutex
272272
for _, inputProof := range p.AdditionalInputs {

0 commit comments

Comments
 (0)