silverback
silverback copied to clipboard
feat: adds @cron task decorator
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)
~~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
p.s. this website had some good test cases: https://crontab.guru/
closed in favor of #230