silverback icon indicating copy to clipboard operation
silverback copied to clipboard

feat: adds @cron task decorator

Open mikeshultz opened this issue 1 year ago • 2 comments

What I did

Adds the @cron task decorator so we can execute arbitrary tasks according to a crontab schedule.

How I did it

Adds an event loop to the runner that checks if cron tasks should be executes. If true, it will kiq the tasks off.

How to verify it

@app.cron("*/5 * * * *")
def every_five_minutes():
    return {"crontime": datetime.utcnow()}

Checklist

  • [x] Passes all linting checks (pre-commit and CI jobs)
  • [ ] New test cases have been added and are passing
  • [x] Documentation has been updated
  • [x] PR title follows Conventional Commit standard (will be automatically included in the changelog)

mikeshultz avatar Feb 23 '24 00:02 mikeshultz

~~Upgraded this, but need to figure out why crons aren't triggering~~


Edit: figured out it was due to an internal failure 7a93ab3, which weren't getting displayed properly b77e718

fubuloubu avatar Jun 01 '24 22:06 fubuloubu

p.s. this website had some good test cases: https://crontab.guru/

fubuloubu avatar Jun 04 '24 01:06 fubuloubu

closed in favor of #230

fubuloubu avatar Apr 21 '25 23:04 fubuloubu