Repository navigation
Conversation
This branch has not been deployed
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.
Change Summary
Running jobs retain their overdue
next_run_atuntil execution finishes. The scheduler excludes them from dispatch but still uses them to select its next wake, causing repeated 0.1-second polls when there is nothing dispatchable instead of using the default 60-second polling interval. Completed jobs with an overdue timestamp can select the same unnecessary wake.Exclude running and completed jobs from wake selection. Recompute the timer after persisting a result in both execution paths, so short recurring schedules are not delayed until the normal polling deadline.
Tests cover inactive states, future jobs, recovery transitions, concurrent running jobs, recurring completion, and shutdown. With normal package imports, the final tests produce 8 failures and 103 passes on the original implementation, then 111 passes with this patch.
Validation:
python -m pytest tests/cron -q, changed-file pre-commit hooks,pip check, andgit diff --checkpass. Fullpre-commit run --all-fileswas attempted and fails on existing repository lint/style issues, including.dev_scripts/webui/oss_distribution.py:140andms_agent/config/skills_manager.py:61. Unrelated automatic formatting was reverted. The full repository test suite was not run.Pause-during-execution state preservation is handled separately in #1022 and is not included here. No CPU savings were measured.
Prepared and tested with AI assistance.
Related issue number
None. Found while inspecting scheduler wake selection; this does not overlap #1013's interval timezone normalization.
Checklist
pre-commit installandpre-commit run --all-filesbefore git commit, and passed lint check. Both ran; existing full-repository failures are described above.