From 43a3ffe2a027d6298cfbaf2e2001bc3917a5a9ef Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 17 May 2019 18:20:36 +0800 Subject: [PATCH] =?UTF-8?q?:whale:=20=E9=99=90=E5=88=B6=20CPU=E3=80=81?= =?UTF-8?q?=E5=86=85=E5=AD=98=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- output/run.go | 2 +- playground/run.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/output/run.go b/output/run.go index 65aeb6a..9f7b65f 100644 --- a/output/run.go +++ b/output/run.go @@ -51,7 +51,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { var cmd *exec.Cmd if conf.Docker { fileName := filepath.Base(filePath) - cmd = exec.Command("timeout", "5", "docker", "run", "--rm", "-v", filePath+":/"+fileName, conf.DockerImageGo, "/"+fileName) + cmd = exec.Command("timeout", "5", "docker", "run", "--rm", "--cpus", "0.1", "--memory", "32m", "-v", filePath+":/"+fileName, conf.DockerImageGo, "/"+fileName) } else { cmd = exec.Command(filePath) curDir := filepath.Dir(filePath) diff --git a/playground/run.go b/playground/run.go index 3d50de6..b4d4bce 100644 --- a/playground/run.go +++ b/playground/run.go @@ -52,7 +52,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { var cmd *exec.Cmd if conf.Docker { fileName := filepath.Base(filePath) - cmd = exec.Command("timeout", "5", "docker", "run", "--rm", "-v", filePath+":/"+fileName, conf.DockerImageGo, "/"+fileName) + cmd = exec.Command("timeout", "5", "docker", "run", "--rm", "--cpus", "0.1", "--memory", "32m", "-v", filePath+":/"+fileName, conf.DockerImageGo, "/"+fileName) } else { cmd = exec.Command(filePath) curDir := filepath.Dir(filePath)