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

Fix/ha scheduler rescheduling ha tasks #613

Merged

Conversation

schroda
Copy link
Collaborator

@schroda schroda commented Jul 24, 2023

No description provided.

@schroda schroda force-pushed the fix/ha_scheduler_rescheduling_ha_tasks branch from e5e8bff to 7af86d1 Compare July 24, 2023 21:01
@schroda schroda marked this pull request as draft July 24, 2023 21:14
@schroda schroda force-pushed the fix/ha_scheduler_rescheduling_ha_tasks branch from 7af86d1 to 776870d Compare July 24, 2023 22:55
@schroda schroda marked this pull request as ready for review July 24, 2023 22:59
@schroda schroda marked this pull request as draft July 25, 2023 07:48
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
@schroda schroda force-pushed the fix/ha_scheduler_rescheduling_ha_tasks branch from 776870d to 4f26880 Compare July 25, 2023 10:32
@schroda schroda force-pushed the fix/ha_scheduler_rescheduling_ha_tasks branch from 7ca5969 to a868fc6 Compare July 25, 2023 10:51
@schroda schroda marked this pull request as ready for review July 25, 2023 10:53
schroda added 4 commits July 25, 2023 13:24
Caused a "ConcurrentModificationException" and broke the system suspension detection due to the unhandled exception canceling the task
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
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.
@schroda schroda force-pushed the fix/ha_scheduler_rescheduling_ha_tasks branch from a868fc6 to eded283 Compare July 25, 2023 11:55
@Syer10 Syer10 merged commit 50f9886 into Suwayomi:master Jul 26, 2023
@schroda schroda deleted the fix/ha_scheduler_rescheduling_ha_tasks branch July 26, 2023 07:26
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.

2 participants