-
Notifications
You must be signed in to change notification settings - Fork 548
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
WIP - Ticker Rewrite #2996
WIP - Ticker Rewrite #2996
Conversation
Update code.
This commit changes TickerTask#halt to block and process all remaining tasks.
…n/tasks/TickerTask.java Co-authored-by: Daniel Walsh <walshydev@gmail.com>
Co-authored-by: Daniel Walsh <walshydev@gmail.com>
Minor changes to the ticker task
I think this can now be un-marked as a draft. |
|
What... this compiled fine for me yesterday |
…ce/ticker-rewrite
Fix compile error in TickerTask
Ok now that this compiles... can it be un-marked as a draft? |
The `processSyncTasks` method had a bug in it which caused an infinite loop. This was running on the main thread (since sync) and thus never terminated. On shutdown we call `tick()`, this will submit async tasks and process the final sync tasks. In `processSyncTasks` we have a while loop. `while (!plugin.isEnabled() || deadline > System.nanoTime()) {` the plugin is shutting down therefore `isEnabled` will return false meaning this while loop will always trigger. Next we polled the tasks (`syncTasks.poll(MAX_POLL_TIME, TimeUnit.NANOSECONDS);`). When there are none left this will return null. We have a null check and inside that block we haev `if (plugin.isEnabled()) { break; }`. We want to break out of this loop however as mentioned already `isEnabled` will return false and thus causing this infinite loop bug.
Kudos, SonarCloud Quality Gate passed! |
Things to address: |
About thread interruption: I suppose we actually do need to re-interrupt the thread for |
Re-Interrupt the thread.
Is unit testing the only thing missing on this PR or are there other issues to be resolved? |
I wish I knew |
closing this as stale. |
Description
This Pull Request was originally created by @LinoxGH, see #2290.
We have decided that it is not ready to merged into
master
yet as there is still a lot that needs to be tweaked.That's why I am reopening it under a new branch inside the main repository.
Proposed changes
This makes some changes to the way
TickerTask
schedules its tasks.Checklist
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values