优化
This commit is contained in:
@@ -48,17 +48,16 @@ func (s *TaskScheduler) Start(ctx context.Context) error {
|
||||
s.seconds.Start()
|
||||
items, _, err := s.tasks.ListTasks(ctx, 0, 0, nil)
|
||||
if err == nil {
|
||||
loaded := 0
|
||||
for _, task := range items {
|
||||
if task.Enabled {
|
||||
if scheduleErr := s.Schedule(task); scheduleErr != nil {
|
||||
s.logger.ErrorContext(ctx, "restore timed task failed", "id", task.ID, "error", scheduleErr)
|
||||
} else {
|
||||
loaded++
|
||||
}
|
||||
}
|
||||
}
|
||||
s.logger.InfoContext(ctx, "定时任务加载完成", "task_count", loaded)
|
||||
// GVA reports the number of rows read from the database, not only
|
||||
// the enabled rows that were scheduled successfully.
|
||||
s.logger.InfoContext(ctx, "定时任务加载完成", "task_count", len(items))
|
||||
} else {
|
||||
s.logger.WarnContext(ctx, "timed task table is not ready", "error", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user