~ols/yeet

66de0208c19e69ed3a665b0c2239a8f6f3b92079 — Ted Unangst 3 years ago 3db08a9
set rlimit in backend
2 files changed, 11 insertions(+), 0 deletions(-)

M backend.go
M sensors.go
M backend.go => backend.go +4 -0
@@ 94,6 94,10 @@ func backendServer() {
	if err != nil {
		log.Panicf("unable to register shrinker: %s", err)
	}
	err = setLimits()
	if err != nil {
		log.Printf("error setting backend limits: %s", err)
	}
	for _, h := range backendhooks {
		h()
	}

M sensors.go => sensors.go +7 -0
@@ 41,3 41,10 @@ func getSensors() Sensors {

	return sensors
}

func setLimits() error {
	var limit syscall.Rlimit
	limit.Cur = 2 * 1024 * 1024 * 1024
	limit.Max = 2 * 1024 * 1024 * 1024
	return syscall.Setrlimit(syscall.RLIMIT_DATA, &limit)
}