-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/ha scheduler rescheduling ha tasks (#613)
* Correctly set the "firstExecutionTime" of a "HATask" In case an initial delay is used for "Timer::scheduleAtFixedRate" (e.g. when rescheduling) then the "firstExecutionTime" of the "HATask" was incorrect, since it considered the first execution to be based on the actual interval. This caused - calculations for execution times (e.g. "timeToNextExecution", "nextExecutionTime") to be incorrect - the ordering of the "scheduledTasks" queue to be incorrect * Add logging * Do not modify queue during forEach loop Caused a "ConcurrentModificationException" and broke the system suspension detection due to the unhandled exception canceling the task * Log all uncaught exceptions In case an exception is uncaught/unhandled, it only gets logged in the console, but is not included in the log file. E.g. the "HAScheduler::scheduleHibernateCheckerTask" task caused an unhandled "ConcurrentModificationException" which caused the task to get dropped. In the log files this error could not be seen and thus, analysing the issue of the suspension detection to stop working was not possible via the logs * Schedule "HATask" immediately when its last execution was missed The missed execution was never triggered * Calculate the "HATask" "last execution time" correctly When scheduling a task for the first time, the "first execution time" is in the future. This time is used for by all functions calculating times for this task (e.g. next/last execution time). In case the first execution didn't happen yet and the current time, would have been an "execution time" based on the interval, the "hibernation detection" would trigger for this task, since it would think that the last execution was missed, due to the "last execution" being in the future. To prevent this, it has to be made sure, that the "last execution time" is in the past.
- Loading branch information
Showing
2 changed files
with
56 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters