Skip to content

Commit

Permalink
fix JobLifeCycle
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzm0809 committed Dec 26, 2023
1 parent a20b680 commit df76f79
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ public void initTenantByTaskId(Integer id) {
}

@Override
@Transactional(rollbackFor = Exception.class)
public boolean changeTaskLifeRecyle(Integer taskId, JobLifeCycle lifeCycle) throws SqlExplainExcepition {
TaskDTO task = getTaskInfoById(taskId);
task.setStep(lifeCycle.getValue());
Expand All @@ -504,7 +505,14 @@ public boolean changeTaskLifeRecyle(Integer taskId, JobLifeCycle lifeCycle) thro
Integer taskVersionId = taskVersionService.createTaskVersionSnapshot(task);
task.setVersionId(taskVersionId);
}
return saveOrUpdate(task.buildTask());
boolean saved = saveOrUpdate(task.buildTask());
if (saved && Asserts.isNotNull(task.getJobInstanceId())) {
JobInstance jobInstance = jobInstanceService.getById(task.getJobInstanceId());
jobInstance.setStep(lifeCycle.getValue());
jobInstanceService.updateById(jobInstance);
log.info("jobInstance [{}] step change to {}", jobInstance.getJid(), lifeCycle.getValue());
}
return saved;
}

@Override
Expand Down

0 comments on commit df76f79

Please sign in to comment.