Conversation
|
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.



Summary
Improves the reliability of scheduled tasks that are created via
WindowsScheduleManager(used by OK-WW's "Task Schedule" tab).When a scheduled task is set with
StartWhenAvailable=false(the current default injected into the task XML), Windows skips the run entirely if the machine is asleep or powered off at the scheduled time. For daily tasks like "run the farm routine every morning", this is the main reason a task is silently missed the next day even though the schedule is registered and "ready".This PR flips the generated XML setting to
<StartWhenAvailable>true</StartWhenAvailable>, so a missed trigger (e.g., the PC was asleep at the trigger time) is executed once the machine becomes available again.Why this is separate from the "manual refresh" symptom
Opening the Schedule tab already triggers a
force_sync(ScheduleTaskTab.load_tasks→on_refresh→query_all_tasks(force_sync=True)) that re-reads the OS. The OS-level trigger is independent of that UI cache, so a registered and enabled task WILL still fire the next day — the refresh only affects what the UI displays. The real reliability gap is the power-state skip, which this PR addresses.Test plan
python -m py_compileonok/util/windows_schedule.pypasses.\Task\Settings\StartWhenAvailableelement istrue(e.g. viaschtasks /Query /XML).