mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #2872 from bprashanth/log_gomax
etcdmain: explicitly set gomaxprocs and log its value
This commit is contained in:
commit
4e0b28f1ca
@ -23,6 +23,8 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/coreos/etcd/discovery"
|
||||
@ -70,6 +72,13 @@ func Main() {
|
||||
|
||||
var stopped <-chan struct{}
|
||||
|
||||
GoMaxProcs := 1
|
||||
if envMaxProcs, err := strconv.Atoi(os.Getenv("GOMAXPROCS")); err == nil {
|
||||
GoMaxProcs = envMaxProcs
|
||||
}
|
||||
log.Printf("main: setting maximum number of CPUs to %d, total number of available CPUs is %d", GoMaxProcs, runtime.NumCPU())
|
||||
runtime.GOMAXPROCS(GoMaxProcs)
|
||||
|
||||
// TODO: check whether fields are set instead of whether fields have default value
|
||||
if cfg.name != defaultName && cfg.initialCluster == initialClusterFromName(defaultName) {
|
||||
cfg.initialCluster = initialClusterFromName(cfg.name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user