Skip to content

fix(cron): skip non-dispatchable jobs when arming timer - #998

Open
lewismosciski wants to merge 1 commit into
modelscope:mainfrom
lewismosciski:fix/cron-scheduler-idle-wakeup
Open

lewismosciski wants to merge 1 commit into
modelscope:mainfrom
lewismosciski:fix/cron-scheduler-idle-wakeup

Conversation

@lewismosciski

Copy link
Copy Markdown

Change Summary

A running cron job keeps its past next_run_at until it finishes. The timer uses that timestamp to wake every 0.1 seconds, although dispatch correctly skips the job. With a 60-second tick interval, a local reproduction recorded six empty ticks in 650 ms.

Exclude running and completed jobs when choosing the next timer deadline, matching the dispatch filter. Other scheduled jobs still determine the next wake-up.

Validation: four regression cases failed before the fix; all 102 cron tests passed afterward. The same timer reproduction produced zero empty ticks after the fix. Changed-file pre-commit passed. Full-repo pre-commit still reports existing main failures, including ms_agent/config/skills_manager.py:61 and ms_agent/permission/shell_validator.py:91.

Related issue number

None; found while checking cron scheduling.

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Run pre-commit install and pre-commit run --all-files before git commit, and passed lint check. Full-repo failures noted above.
  • Documentation reflects the changes where applicable (no new command or configuration)

This branch has not been deployed

No deployments
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.

1 participant