-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Extend sleep if it doesn't scheduled date #95
base: main
Are you sure you want to change the base?
Conversation
Looking over the original issue, it seems as though there are three underlying issues:
Unfortunately, the solution you've provided in this PR has two significant issues:
I very much agree that the issue you're trying to solve needs to be addressed, but I don't believe this is the best solution. Even without addressing the fundamental design flaw with how the scheduler functions, it should be possible to work around the immediate problem within the scheduler logic without having to place additional "buffering" logic around the jobs themselves. (P.S.: If this post reads as disparaging or in any other way discouraging, please understand it isn't at all intended to be that way. Yours and everyone's contributions are always welcome, even when there may be issues with them!) |
Thank you for detailed response and review. I agree what you say.
May be I understand it.
Yes.
Yes.
Ah.. I understand it.
Oh sorry. By the way, I get a new idea that is way to more smart from your comment. |
This patch fixes a bug #94 which I reported.
If
eventLoop.scheduleRepeatedTask
completes before scheduled time, it reschedules.So it guaranteed for user that scheduled job doesn't start before scheduled time and prevent unwanted immediate double execution.
To implement this, I changed
AnyScheduledJob.Task
toclass
.Because underlying
NIO.RepeatedTask
is recreated and I need to take new instance of it.I implement carefully to avoid race condition about
var isCancelled
,var innerTask
by guarded them withEventLoop
.