core/go: use max procs (#4766)

* core/go: use max procs

* update test

* logging
This commit is contained in:
Caleb Doxsey 2023-12-07 09:14:57 -07:00 committed by GitHub
parent 9db828ffd4
commit ce8abde236
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 12 deletions

View file

@ -5,9 +5,7 @@ package storagetest
import (
"context"
"fmt"
"os"
"runtime"
"strconv"
"sync"
"testing"
@ -115,7 +113,7 @@ func TestBackendPatch(t *testing.T, ctx context.Context, backend storage.Backend
})
t.Run("concurrent", func(t *testing.T) {
if n := gomaxprocs(); n < 2 {
if n := runtime.GOMAXPROCS(0); n < 2 {
t.Skipf("skipping concurrent test (GOMAXPROCS = %d)", n)
}
@ -177,11 +175,3 @@ func truncateTimestamps(ts ...*timestamppb.Timestamp) {
t.Nanos = (t.Nanos / 1000) * 1000
}
}
func gomaxprocs() int {
env := os.Getenv("GOMAXPROCS")
if n, err := strconv.Atoi(env); err == nil {
return n
}
return runtime.NumCPU()
}