GOMAXPROCS usage instead of NumCPU (#1801)

This commit is contained in:
Alexey Makhov 2021-06-29 05:37:08 +03:00 committed by GitHub
parent e757f78923
commit b7d23d446c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -91,7 +91,7 @@ func (opt *ClusterOptions) init() {
} }
if opt.PoolSize == 0 { if opt.PoolSize == 0 {
opt.PoolSize = 5 * runtime.NumCPU() opt.PoolSize = 5 * runtime.GOMAXPROCS(0)
} }
switch opt.ReadTimeout { switch opt.ReadTimeout {

View File

@ -77,7 +77,7 @@ type Options struct {
WriteTimeout time.Duration WriteTimeout time.Duration
// Maximum number of socket connections. // Maximum number of socket connections.
// Default is 10 connections per every CPU as reported by runtime.NumCPU. // Default is 10 connections per every available CPU as reported by runtime.GOMAXPROCS.
PoolSize int PoolSize int
// Minimum number of idle connections which is useful when establishing // Minimum number of idle connections which is useful when establishing
// new connection is slow. // new connection is slow.
@ -136,7 +136,7 @@ func (opt *Options) init() {
} }
} }
if opt.PoolSize == 0 { if opt.PoolSize == 0 {
opt.PoolSize = 10 * runtime.NumCPU() opt.PoolSize = 10 * runtime.GOMAXPROCS(0)
} }
switch opt.ReadTimeout { switch opt.ReadTimeout {
case -1: case -1: