Fix Schedules not running via "Run Now" if schedule is marked "Only when server is online" - #5689
Open
Sanic5238 wants to merge 3 commits into
Open
Conversation
…dule was manually ran
…force run while server is offline
… skipping of a scheduled job.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small fix that fixes an issue where using the [Run Now] function within a schedule it will silently fail and refuse to run if the schedule tasks are set to run only when server is online.
If the user would like to force run a schedule via the button, the expectation would be for the schedule to run even with these settings.
This issue was originally caused by $now not getting checked as part of https://github.com/pterodactyl/panel/blob/1.0-develop/app/Services/Schedules/ProcessScheduleService.php#L45 meaning it would the resulting task would get thrown away before it could be handled. This has been fixed via adding it to the if statement
After implementing an issue was found in testing where schedules that included console command runs would cause an error message to appear, due to the console being unreachable, in technicality telling the schedules to continue on failure would fix this, but users shouldn't be expected to turn this on and since the error had no information this would of caused undue stress on the discord lol. This has been fixed as per the below
Added a helper script within the RunTaskJob.php to allow skipping of a schedule task but to continue the rest of the schedule to ensure tasks are marked off the daemon to ensure schedules don't get stuck processing.
also added use Pterodactyl\Models\Task to ProcessScheduleService as it was needed for the check.
otherwise also added an if statement to check if this condition is met [Server is offline/stopping and task is to send a command] and if so to skip the task and move to the next.
Testing for this fix involved and results
Below tests were added after failures caused in first commit of schedules not running after the action command due to failure as console was offline.
Currently there's no notification sent that a task was skipped as part of this condition, please let me know if you'd like some sort of notification for the user during this edge case.
Fixes: #5258