不依赖上一周期repeat job的生成job的策略bug,改的只是这个addRepeatJobForInterval()--卢松 #375
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
addRepeatJobForInterval()修改的bug,
主要两点:
nextTriggerTime
要大于getLastGenerateTriggerTime(),每一轮都要大于上一轮的getLastGenerateTriggerTime。
防止上次生成的job正在执行时,这轮又可以生成重复的可执行job,因为这里是通过数据库taskid和tasktracker
唯一索引去重的。原来的逻辑会在上一轮的job正在执行时,生成重复的job。
另一点:
第一次生成job时,lastGenerateTriggerTime应该为0,而不是now。因为如果是now的话,nextTriggerTime
有可能选择时小于now,导致少生成一次job。
逻辑已经测过,不会多生成job,也不会少生成job。