Merge pull request #17108 from gouqi11/fixUserPwdExpiredNotify

fxi(scheduledtask): skip task when scheduledtask.labels is empty
This commit is contained in:
Zexi Li
2023-05-19 17:30:36 +08:00
committed by GitHub
@@ -554,6 +554,16 @@ func (stm *SScheduledTaskManager) Timer(ctx context.Context, userCred mcclient.T
waitQueue := make(chan struct{}, len(sts))
for i := range sts {
log.Infof("sts[%d]: %s", i, jsonutils.Marshal(sts[i]))
// 对于关联资源为空或获取关联资源异常的定时任务,不执行
lables, err := sts[i].Labels()
if err != nil {
log.Errorf("scheduled_task get lables error:%s", err.Error())
continue
}
if len(lables) == 0 {
log.Errorf("scheduled_task %s lables not found:", sts[i].Id)
continue
}
st := sts[i]
timerQueue <- struct{}{}
waitQueue <- struct{}{}