fix: 解决应用内存限制回显失败的问题 (#1237)

This commit is contained in:
zhengkunwang223 2023-06-02 17:45:24 +08:00 committed by GitHub
parent 3773d64aa7
commit 957499e4d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -900,7 +900,7 @@ func getAppCommonConfig(envs map[string]interface{}) request.AppContainerConfig
config.CpuQuota = 0
}
if memLimit, ok := envs[constant.MemoryLimit]; ok {
re := regexp.MustCompile(`(\d+(?:\.\d+)?)\s*([KMGT]?B)`)
re := regexp.MustCompile(`(\d+)([A-Za-z]+)`)
matches := re.FindStringSubmatch(memLimit.(string))
if len(matches) == 3 {
num, err := strconv.ParseFloat(matches[1], 64)