taskiq icon indicating copy to clipboard operation
taskiq copied to clipboard

feat(scheduler): add interval

Open d3vyce opened this issue 7 months ago • 1 comments

Hi!

As discuss in #290 #348

In this PR, I'm adding the ability to run scheduled tasks every X seconds. This fills a gap that CRON doesn't allow. To avoid loop invocation spam, I calculate the next run based on which tasks are closest to executing. The next run is therefore dynamic.

This PR is still a WIP, but I welcome feedback to adjust the code if necessary. I still have to do:

  • [x] Base implementation
  • [x] Documentation
  • [x] Clean code
  • [x] Tests

d3vyce avatar May 20 '25 20:05 d3vyce

I added interval into test_label_discovery, I think it could be a good idea to also test the interval_next_run in a complex setup. Like when combining interval tasks with cron and time. Not sure how to do it, but if you have any ideas for implementation, I remain available to integrate them if necessary. In any case ready for a review and feedback !

d3vyce avatar Jun 27 '25 20:06 d3vyce

This functionality has already been implemented in https://github.com/taskiq-python/taskiq/pull/498

danfimov avatar Dec 01 '25 11:12 danfimov