Skip to content

Commit

Permalink
fix Transition
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyan1998 committed Dec 13, 2023
1 parent 180f4c1 commit 934c452
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,25 @@ public static boolean refreshJob(JobInfoDetail jobInfoDetail, boolean needSave)

if (JobStatus.isTransition(jobInstance.getStatus())) {
Long finishTime = TimeUtil.localDateTimeToLong(jobInstance.getFinishTime());
long duration = Duration.between(jobInstance.getFinishTime(), LocalDateTime.now()).toMinutes();
long duration = Duration.between(jobInstance.getFinishTime(), LocalDateTime.now())
.toMinutes();
if (finishTime > 0 && duration < 1) {
log.debug("Job is transition: {}->{}", jobInstance.getId(), jobInstance.getName());
isTransition = true;
} else if (JobStatus.RECONNECTING.getValue().equals(jobInstance.getStatus())) {
log.debug("Job is not reconnected success at the specified time,set as UNKNOWN: {}->{}",
jobInstance.getId(), jobInstance.getName());
log.debug(
"Job is not reconnected success at the specified time,set as UNKNOWN: {}->{}",
jobInstance.getId(),
jobInstance.getName());
jobInstance.setStatus(JobStatus.UNKNOWN.getValue());
}
}

boolean isDone = (JobStatus.isDone(jobInstance.getStatus()))
|| (TimeUtil.localDateTimeToLong(jobInstance.getFinishTime()) > 0
&& Duration.between(jobInstance.getFinishTime(), LocalDateTime.now())
.toMinutes()
>= 1);
&& Duration.between(jobInstance.getFinishTime(), LocalDateTime.now())
.toMinutes()
>= 1);

isDone = !isTransition && isDone;

Expand Down

0 comments on commit 934c452

Please sign in to comment.