Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不依赖上一周期repeat job的生成job的策略bug,改的只是这个addRepeatJobForInterval()--卢松 #375

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lusong1986
Copy link
Contributor

addRepeatJobForInterval()修改的bug,
主要两点:
nextTriggerTime
要大于getLastGenerateTriggerTime(),每一轮都要大于上一轮的getLastGenerateTriggerTime。
防止上次生成的job正在执行时,这轮又可以生成重复的可执行job,因为这里是通过数据库taskid和tasktracker
唯一索引去重的。原来的逻辑会在上一轮的job正在执行时,生成重复的job。

另一点:
第一次生成job时,lastGenerateTriggerTime应该为0,而不是now。因为如果是now的话,nextTriggerTime
有可能选择时小于now,导致少生成一次job。

逻辑已经测过,不会多生成job,也不会少生成job。

主要两点:
nextTriggerTime
要大于getLastGenerateTriggerTime(),每一轮都要大于上一轮的getLastGenerateTriggerTime。
防止上次生成的job正在执行时,这轮又可以生成重复的可执行job,因为这里是通过数据库taskid和tasktracker
唯一索引去重的。原来的逻辑会在上一轮的job正在执行时,生成重复的job。

另一点:
第一次生成job时,lastGenerateTriggerTime应该为0,而不是now。因为如果是now的话,nextTriggerTime
有可能选择时小于now,导致少生成一次job。

逻辑已经测过,不会多生成job,也不会少生成job。
@lusong1986 lusong1986 changed the title 不依赖上一周期repeat job的生成job的策略bug,改的只是这个addRepeatJobForInterval() 不依赖上一周期repeat job的生成job的策略bug,改的只是这个addRepeatJobForInterval()--卢松 Sep 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant