Selaa lähdekoodia

fix(worker): disabled memory limit

rsync memory is nolonger limited
bigeagle 8 vuotta sitten
vanhempi
sitoutus
21c832c8fb
2 muutettua tiedostoa jossa 14 lisäystä ja 15 poistoa
  1. 9 9
      worker/cgroup.go
  2. 5 6
      worker/cgroup_test.go

+ 9 - 9
worker/cgroup.go

@@ -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
 }
 

+ 5 - 6
worker/cgroup_test.go

@@ -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()
 	})
 }