Skip to content

Commit

Permalink
Merge pull request ltsopensource#370 from lusong1986/repeatjob-repeat…
Browse files Browse the repository at this point in the history
…edcount-bug

修复Repeatjob执行完成后不能删除job(不依赖上周期)和不能更新repeatedCount(依赖上周期)的bug
  • Loading branch information
qq254963746 authored Sep 1, 2017
2 parents 0f493f4 + 7c29a61 commit e5652a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ private void finishNoReplyPrevRepeatJob(JobMeta jobMeta, boolean isRetryForThisT
// 如果当前完成的job是重试的,那么不要增加repeatedCount
if (!isRetryForThisTime) {
// 更新repeatJob的重复次数
appContext.getRepeatJobQueue().incRepeatedCount(jobPo.getJobId());
final int jobQueueRepeatedCount = appContext.getRepeatJobQueue().incRepeatedCount(jobPo.getJobId());
if (jobQueueRepeatedCount >= jobPo.getRepeatCount()) {
appContext.getRepeatJobQueue().remove(jobPo.getJobId());
jobRemoveLog(jobPo, "Repeat");
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public void onComplete(List<JobRunResult> results) {
nextRetryTriggerTime = nexTriggerTime;
jobPo = repeatJobPo;
} else {
jobPo.setInternalExtParam(Constants.IS_RETRY_JOB, Boolean.TRUE.toString());
if(jobPo.getRetryTimes() < repeatJobPo.getMaxRetryTimes()) { //最后一次重试时,这个参数不能设置,为了在finishHandler时能执行到incRepeatedCount
jobPo.setInternalExtParam(Constants.IS_RETRY_JOB, Boolean.TRUE.toString());
}
}
}
}
Expand Down

0 comments on commit e5652a2

Please sign in to comment.