mirror of
https://github.com/gotoeasy/glogcenter.git
synced 2025-09-15 12:58:34 +08:00
增加CPU配置
This commit is contained in:
parent
ada476b8c9
commit
cf3d4add7e
@ -89,19 +89,17 @@ func UpdateConfigByEnv() {
|
||||
minioPassword = cmn.GetEnvStr("GLC_MINIO_PASS", "") // MINIO密码,默认“”
|
||||
minioBucket = cmn.GetEnvStr("GLC_MINIO_BUCKET", "") // MINIO桶名,默认“”
|
||||
enableUploadMinio = cmn.GetEnvBool("GLC_ENABLE_UPLOAD_MINIO", false) // 是否开启上传备份至MINIO服务器,默认false
|
||||
goMaxProcess = getGoMaxProcessConf(cmn.GetEnvInt("GLC_GOMAXPROCS", runtime.NumCPU()-1)) // 是否开启上传备份至MINIO服务器,默认false
|
||||
goMaxProcess = getGoMaxProcessConf(cmn.GetEnvInt("GLC_GOMAXPROCS", -1)) // 使用的最大CPU数量,默认是最大CPU数量(设定值不在实际数量范围是按最大看待)
|
||||
}
|
||||
|
||||
// 取配置: 服务URL,集群配置时自动获取地址可能不对,可通过环境变量“GLC_ENABLE_BACKUP”设定,默认“”
|
||||
// 取配置: 使用的最大CPU数量,可通过环境变量“GLC_GOMAXPROCS”设定,默认最大CPU数量
|
||||
func GetGoMaxProcess() int {
|
||||
return goMaxProcess
|
||||
}
|
||||
func getGoMaxProcessConf(n int) int {
|
||||
if n < 1 {
|
||||
n = 1
|
||||
}
|
||||
if n > runtime.NumCPU() {
|
||||
n = runtime.NumCPU()
|
||||
max := runtime.NumCPU()
|
||||
if n < 1 || n > max {
|
||||
n = max
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
package onstart
|
||||
|
||||
const VERSION = "glogcenter 0.8.2"
|
||||
const VERSION = "glogcenter 0.8.3"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user