mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 08:50:42 +02:00
core/go: use max procs (#4766)
* core/go: use max procs * update test * logging
This commit is contained in:
parent
9db828ffd4
commit
ce8abde236
5 changed files with 10 additions and 12 deletions
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue