Skip to content

v0.6.0 - Scheduler Core Efficiency (Phase 2/6)

Choose a tag to compare

@nandyalu nandyalu released this 05 Aug 04:06
· 4 commits to main since this release
a7fd0d5

Phase 2 of the roadmap to v1.0.0: smart sleep loop and handler signature caching.

What's new

  • Sub-second intervals — the scheduler loop now sleeps until the next due task on an interruptible wait instead of polling every second. add_task(interval=0.2) works; dispatch jitter drops from up to ~1 s to milliseconds.
  • Zero idle polling — an idle scheduler issues no database queries (bounded by a 60-second safety-net wake-up). Schedule changes (add_task, run_task_immediately, resume_task, remove_task) and job completions wake the loop immediately, so deferred tasks dispatch as soon as a pool slot frees and shutdown() returns promptly instead of waiting out the current sleep.
  • Handler signature caching — each handler's injectable kwargs (_job_id, _stop_event, _progress_hook) are introspected once per handler lifetime (weakly cached) instead of three inspect.signature() calls per dispatch.

Fixes

  • When the pool is saturated, the loop no longer busy-polls the database at ~100 Hz over overdue tasks it cannot dispatch anyway; it sleeps until a finishing job wakes it.

Housekeeping

  • 7 new tests: timing tests for dispatch latency, sub-second runs, idle no-polling, backpressure dispatch-on-slot-free, and prompt shutdown, plus a smoke test codifying the manual 0.1 s-interval throughput check. Docs, release notes, and AI-tooling artifacts updated; version bumped to 0.6.0.

Full Changelog: v0.5.0...v0.6.0