fix(worker): disabled memory limit

rsync memory is nolonger limited
This commit is contained in:
bigeagle 2016-12-09 23:07:05 +08:00
parent 81a15e7dd1
commit 21c832c8fb
2 changed files with 14 additions and 15 deletions

View File

@ -52,15 +52,15 @@ func (c *cgroupHook) preExec() error {
if err := sh.Command("cgcreate", "-g", c.Cgroup()).Run(); err != nil { if err := sh.Command("cgcreate", "-g", c.Cgroup()).Run(); err != nil {
return err return err
} }
if cgSubsystem != "memory" { // if cgSubsystem != "memory" {
return nil // return nil
} // }
if c.provider.Type() == provRsync || c.provider.Type() == provTwoStageRsync { // if c.provider.Type() == provRsync || c.provider.Type() == provTwoStageRsync {
gname := fmt.Sprintf("%s/%s", c.baseGroup, c.provider.Name()) // gname := fmt.Sprintf("%s/%s", c.baseGroup, c.provider.Name())
return sh.Command( // return sh.Command(
"cgset", "-r", "memory.limit_in_bytes=512M", gname, // "cgset", "-r", "memory.limit_in_bytes=512M", gname,
).Run() // ).Run()
} // }
return nil return nil
} }

View File

@ -4,7 +4,6 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strconv"
"strings" "strings"
"testing" "testing"
"time" "time"
@ -134,11 +133,11 @@ sleep 30
provider.AddHook(cg) provider.AddHook(cg)
cg.preExec() cg.preExec()
if cgSubsystem == "memory" { //if cgSubsystem == "memory" {
memoLimit, err := ioutil.ReadFile(filepath.Join(cg.basePath, "memory", cg.baseGroup, provider.Name(), "memory.limit_in_bytes")) // memoLimit, err := ioutil.ReadFile(filepath.Join(cg.basePath, "memory", cg.baseGroup, provider.Name(), "memory.limit_in_bytes"))
So(err, ShouldBeNil) // So(err, ShouldBeNil)
So(strings.Trim(string(memoLimit), "\n"), ShouldEqual, strconv.Itoa(512*1024*1024)) // So(strings.Trim(string(memoLimit), "\n"), ShouldEqual, strconv.Itoa(512*1024*1024))
} //}
cg.postExec() cg.postExec()
}) })
} }