mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-11 16:06:02 +08:00
fix: 解决编辑已停止计划任务导致任务执行的问题 (#1218)
This commit is contained in:
parent
80599a3576
commit
01ed60fcb7
1 changed files with 10 additions and 5 deletions
|
@ -221,16 +221,20 @@ func (u *CronjobService) Update(id uint, req dto.CronjobUpdate) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return constant.ErrRecordNotFound
|
return constant.ErrRecordNotFound
|
||||||
}
|
}
|
||||||
|
upMap := make(map[string]interface{})
|
||||||
cronjob.EntryID = cronModel.EntryID
|
cronjob.EntryID = cronModel.EntryID
|
||||||
cronjob.Type = cronModel.Type
|
cronjob.Type = cronModel.Type
|
||||||
cronjob.Spec = loadSpec(cronjob)
|
cronjob.Spec = loadSpec(cronjob)
|
||||||
newEntryID, err := u.StartJob(&cronjob)
|
if cronModel.Status == constant.StatusEnable {
|
||||||
if err != nil {
|
newEntryID, err := u.StartJob(&cronjob)
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
upMap["entry_id"] = newEntryID
|
||||||
|
} else {
|
||||||
|
global.Cron.Remove(cron.EntryID(cronjob.EntryID))
|
||||||
}
|
}
|
||||||
|
|
||||||
upMap := make(map[string]interface{})
|
|
||||||
upMap["entry_id"] = newEntryID
|
|
||||||
upMap["name"] = req.Name
|
upMap["name"] = req.Name
|
||||||
upMap["spec"] = cronjob.Spec
|
upMap["spec"] = cronjob.Spec
|
||||||
upMap["script"] = req.Script
|
upMap["script"] = req.Script
|
||||||
|
@ -239,6 +243,7 @@ func (u *CronjobService) Update(id uint, req dto.CronjobUpdate) error {
|
||||||
upMap["day"] = req.Day
|
upMap["day"] = req.Day
|
||||||
upMap["hour"] = req.Hour
|
upMap["hour"] = req.Hour
|
||||||
upMap["minute"] = req.Minute
|
upMap["minute"] = req.Minute
|
||||||
|
upMap["second"] = req.Second
|
||||||
upMap["website"] = req.Website
|
upMap["website"] = req.Website
|
||||||
upMap["exclusion_rules"] = req.ExclusionRules
|
upMap["exclusion_rules"] = req.ExclusionRules
|
||||||
upMap["db_name"] = req.DBName
|
upMap["db_name"] = req.DBName
|
||||||
|
|
Loading…
Add table
Reference in a new issue