mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-07 22:16:16 +08:00
fix: Fix the problem of abnormal logs when error reports occur during… (#8522)
This commit is contained in:
parent
a3f6dc334f
commit
4ecdbcb01f
3 changed files with 6 additions and 1 deletions
|
@ -162,6 +162,7 @@ func (u *CronjobRepo) EndRecords(record model.JobRecords, status, message, recor
|
|||
errMap["status"] = status
|
||||
errMap["file"] = record.File
|
||||
errMap["message"] = message
|
||||
errMap["task_id"] = record.TaskID
|
||||
errMap["interval"] = time.Since(record.StartTime).Milliseconds()
|
||||
if err := global.DB.Model(&model.JobRecords{}).Where("id = ?", record.ID).Updates(errMap).Error; err != nil {
|
||||
global.LOG.Errorf("update record status failed, err: %v", err)
|
||||
|
|
|
@ -54,6 +54,10 @@ func (u *CronjobService) HandleJob(cronjob *model.Cronjob) {
|
|||
if len(message) != 0 {
|
||||
record.Records, _ = mkdirAndWriteFile(cronjob, record.StartTime, message)
|
||||
}
|
||||
taskItem, _ := taskRepo.GetFirst(taskRepo.WithByID(record.TaskID))
|
||||
if len(taskItem.ID) == 0 {
|
||||
record.TaskID = ""
|
||||
}
|
||||
cronjobRepo.EndRecords(record, constant.StatusFailed, err.Error(), record.Records)
|
||||
handleCronJobAlert(cronjob)
|
||||
return
|
||||
|
|
|
@ -39,8 +39,8 @@ func Start() {
|
|||
cron.Init()
|
||||
session.Init()
|
||||
gin.SetMode("debug")
|
||||
InitOthers()
|
||||
hook.Init()
|
||||
InitOthers()
|
||||
|
||||
rootRouter := router.Routers()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue