Unverified Commit cae01d3b authored by gaoyan's avatar gaoyan Committed by GitHub

[Bug]Fix the issue that the status is unknown after the batch task is Finish (#3373)

parent b242eac4
......@@ -167,8 +167,22 @@ public class JobRefreshHandler {
if (!oldStatus.equals(jobInstance.getStatus()) || isDone || needSave) {
log.debug("Dump JobInfo to database: {}->{}", jobInstance.getId(), jobInstance.getName());
jobInstanceService.updateById(jobInstance);
jobHistoryService.updateById(jobInfoDetail.getJobDataDto().toJobHistory());
if (jobInstance.getStatus().equals(JobStatus.UNKNOWN.getValue())
|| jobInstance.getStatus().equals(JobStatus.RECONNECTING.getValue())) {
JobInstance fromDb = jobInstanceService.getById(jobInstance.getId());
// If the job status is unknown and the job status in the database is not done, update the job status
// just prevent the task from being mistakenly updated to UNKNOWN
if (JobStatus.valueOf(fromDb.getStatus()).isDone()) {
// if status is RECONNECTING, ignore it
isDone = true;
} else {
jobInstanceService.updateById(jobInstance);
jobHistoryService.updateById(jobInfoDetail.getJobDataDto().toJobHistory());
}
} else {
jobInstanceService.updateById(jobInstance);
jobHistoryService.updateById(jobInfoDetail.getJobDataDto().toJobHistory());
}
}
if (isDone) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment