From a5304b66e3e4399b89e6f10609acdbe84ce5fa1f Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Mon, 29 Jan 2024 16:34:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=87=8D=E5=90=AF=E5=90=8E=E8=AE=A1=E5=88=92=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#3741)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/init/hook/hook.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/init/hook/hook.go b/backend/init/hook/hook.go index 7422826cb..6dd0a9952 100644 --- a/backend/init/hook/hook.go +++ b/backend/init/hook/hook.go @@ -3,6 +3,7 @@ package hook import ( "encoding/base64" + "github.com/1Panel-dev/1Panel/backend/app/model" "github.com/1Panel-dev/1Panel/backend/app/repo" "github.com/1Panel-dev/1Panel/backend/constant" "github.com/1Panel-dev/1Panel/backend/global" @@ -70,6 +71,7 @@ func Init() { _, _ = cmd.Execf("%s sed -i '/CHANGE_USER_INFO=true/d' /usr/local/bin/1pctl", sudo) } + handleCronjobStatus() handleSnapStatus() } @@ -117,3 +119,11 @@ func handleSnapStatus() { } } } + +func handleCronjobStatus() { + _ = global.DB.Model(&model.JobRecords{}).Where("status = ?", constant.StatusWaiting). + Updates(map[string]interface{}{ + "status": constant.StatusFailed, + "message": "the task was interrupted due to the restart of the 1panel service", + }).Error +}