fix(cronjob): schedule an imported pending job when it is edited (#14464)

* fix(cronjob): schedule an imported pending job when it is edited

Update decided whether to schedule the job from its old status, so a job
imported as Pending was saved as Enable without being added to the
scheduler.

* Delete agent/app/service/cronjob_test.go

---------

Co-authored-by: Ruan Chaves <14352388+ruanchaves@users.noreply.github.com>
Co-authored-by: ssongliu <sloooop1x@gmail.com>
This commit is contained in:
Ruan Chaves
2026-11-18 16:09:39 +08:00
committed by GitHub
co-authored by Ruan Chaves ssongliu
parent faeb39f5c6
commit aaba86d0ef
+1 -1
View File
@@ -784,7 +784,7 @@ func (u *CronjobService) Update(id uint, req dto.CronjobOperate, operator string
return err
}
spec := cronjob.Spec
if cronModel.Status == constant.StatusEnable {
if cronModel.Status == constant.StatusEnable || cronModel.Status == constant.StatusPending {
newEntryIDs, err := u.StartJob(&cronjob, true)
if err != nil {
return err