1
0
镜像自地址 https://github.com/tuna/tunasync.git 已同步 2025-12-06 06:26:46 +00:00

change type of memlimit from string to int64

这个提交包含在:
Miao Wang
2021-07-12 19:09:25 +08:00
父节点 80f0161eb0
当前提交 3ce5c2ede3
共有 6 个文件被更改,包括 45 次插入7 次删除

查看文件

@@ -21,10 +21,10 @@ type cgroupHook struct {
baseGroup string
created bool
subsystem string
memLimit string
memLimit MemBytes
}
func newCgroupHook(p mirrorProvider, basePath, baseGroup, subsystem, memLimit string) *cgroupHook {
func newCgroupHook(p mirrorProvider, basePath, baseGroup, subsystem string, memLimit MemBytes) *cgroupHook {
if basePath == "" {
basePath = "/sys/fs/cgroup"
}
@@ -52,11 +52,11 @@ func (c *cgroupHook) preExec() error {
if c.subsystem != "memory" {
return nil
}
if c.memLimit != "" {
if c.memLimit != 0 {
gname := fmt.Sprintf("%s/%s", c.baseGroup, c.provider.Name())
return sh.Command(
"cgset", "-r",
fmt.Sprintf("memory.limit_in_bytes=%s", c.memLimit),
fmt.Sprintf("memory.limit_in_bytes=%d", c.memLimit.Value()),
gname,
).Run()
}