From b7d23d446cf61bc33d8346f929b814c0c8e7de5d Mon Sep 17 00:00:00 2001 From: Alexey Makhov Date: Tue, 29 Jun 2021 05:37:08 +0300 Subject: [PATCH] GOMAXPROCS usage instead of NumCPU (#1801) --- cluster.go | 2 +- options.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cluster.go b/cluster.go index e5d49dde..49b2d37b 100644 --- a/cluster.go +++ b/cluster.go @@ -91,7 +91,7 @@ func (opt *ClusterOptions) init() { } if opt.PoolSize == 0 { - opt.PoolSize = 5 * runtime.NumCPU() + opt.PoolSize = 5 * runtime.GOMAXPROCS(0) } switch opt.ReadTimeout { diff --git a/options.go b/options.go index 7cf1bc1b..8bbc27b8 100644 --- a/options.go +++ b/options.go @@ -77,7 +77,7 @@ type Options struct { WriteTimeout time.Duration // 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 // Minimum number of idle connections which is useful when establishing // new connection is slow. @@ -136,7 +136,7 @@ func (opt *Options) init() { } } if opt.PoolSize == 0 { - opt.PoolSize = 10 * runtime.NumCPU() + opt.PoolSize = 10 * runtime.GOMAXPROCS(0) } switch opt.ReadTimeout { case -1: