mirror of
https://github.com/tuna/tunasync.git
synced 2025-04-20 20:22:46 +00:00
fix(worker): disabled memory limit
rsync memory is nolonger limited
This commit is contained in:
parent
81a15e7dd1
commit
21c832c8fb
@ -52,15 +52,15 @@ func (c *cgroupHook) preExec() error {
|
||||
if err := sh.Command("cgcreate", "-g", c.Cgroup()).Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
if cgSubsystem != "memory" {
|
||||
return nil
|
||||
}
|
||||
if c.provider.Type() == provRsync || c.provider.Type() == provTwoStageRsync {
|
||||
gname := fmt.Sprintf("%s/%s", c.baseGroup, c.provider.Name())
|
||||
return sh.Command(
|
||||
"cgset", "-r", "memory.limit_in_bytes=512M", gname,
|
||||
).Run()
|
||||
}
|
||||
// if cgSubsystem != "memory" {
|
||||
// return nil
|
||||
// }
|
||||
// if c.provider.Type() == provRsync || c.provider.Type() == provTwoStageRsync {
|
||||
// gname := fmt.Sprintf("%s/%s", c.baseGroup, c.provider.Name())
|
||||
// return sh.Command(
|
||||
// "cgset", "-r", "memory.limit_in_bytes=512M", gname,
|
||||
// ).Run()
|
||||
// }
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@ -134,11 +133,11 @@ sleep 30
|
||||
provider.AddHook(cg)
|
||||
|
||||
cg.preExec()
|
||||
if cgSubsystem == "memory" {
|
||||
memoLimit, err := ioutil.ReadFile(filepath.Join(cg.basePath, "memory", cg.baseGroup, provider.Name(), "memory.limit_in_bytes"))
|
||||
So(err, ShouldBeNil)
|
||||
So(strings.Trim(string(memoLimit), "\n"), ShouldEqual, strconv.Itoa(512*1024*1024))
|
||||
}
|
||||
//if cgSubsystem == "memory" {
|
||||
// memoLimit, err := ioutil.ReadFile(filepath.Join(cg.basePath, "memory", cg.baseGroup, provider.Name(), "memory.limit_in_bytes"))
|
||||
// So(err, ShouldBeNil)
|
||||
// So(strings.Trim(string(memoLimit), "\n"), ShouldEqual, strconv.Itoa(512*1024*1024))
|
||||
//}
|
||||
cg.postExec()
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user