From d07314b5be3ce8bef7bbb0ecc13e05afb1c05579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Wed, 29 Nov 2023 21:12:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=20supervisor=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/supervisor_controller.go | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/app/http/controllers/plugins/supervisor_controller.go b/app/http/controllers/plugins/supervisor_controller.go index f1afd6a6a9..d747c41db1 100644 --- a/app/http/controllers/plugins/supervisor_controller.go +++ b/app/http/controllers/plugins/supervisor_controller.go @@ -296,12 +296,8 @@ func (r *SupervisorController) SaveProcessConfig(ctx http.Context) http.Response return controllers.Error(ctx, http.StatusUnprocessableEntity, err.Error()) } - if out, err := tools.Exec(`supervisorctl reread`); err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, out) - } - if out, err := tools.Exec(`supervisorctl update`); err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, out) - } + _, _ = tools.Exec(`supervisorctl reread`) + _, _ = tools.Exec(`supervisorctl update`) _, _ = tools.Exec(`supervisorctl restart ` + process) return controllers.Success(ctx, nil) @@ -350,15 +346,9 @@ stdout_logfile_maxbytes=2MB return controllers.Error(ctx, http.StatusUnprocessableEntity, err.Error()) } - if out, err := tools.Exec(`supervisorctl reread`); err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, out) - } - if out, err := tools.Exec(`supervisorctl update`); err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, out) - } - if out, err := tools.Exec(`supervisorctl start ` + name); err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, out) - } + _, _ = tools.Exec(`supervisorctl reread`) + _, _ = tools.Exec(`supervisorctl update`) + _, _ = tools.Exec(`supervisorctl start ` + name) return controllers.Success(ctx, nil) } @@ -391,12 +381,8 @@ func (r *SupervisorController) DeleteProcess(ctx http.Context) http.Response { if err := tools.Remove(logPath); err != nil { return controllers.Error(ctx, http.StatusInternalServerError, err.Error()) } - if out, err := tools.Exec(`supervisorctl reread`); err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, out) - } - if out, err := tools.Exec(`supervisorctl update`); err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, out) - } + _, _ = tools.Exec(`supervisorctl reread`) + _, _ = tools.Exec(`supervisorctl update`) return controllers.Success(ctx, nil) }