Chore: use uber max procs

This commit is contained in:
Dreamacro
2021-10-27 21:27:19 +08:00
parent a7aea12aa6
commit ebbc9604ce
4 changed files with 17 additions and 3 deletions

View File

@ -98,8 +98,8 @@ func processUDP() {
func process() {
numUDPWorkers := 4
if runtime.NumCPU() > numUDPWorkers {
numUDPWorkers = runtime.NumCPU()
if num := runtime.GOMAXPROCS(0); num > numUDPWorkers {
numUDPWorkers = num
}
for i := 0; i < numUDPWorkers; i++ {
go processUDP()