keda
keda copied to clipboard
refactor: Simplify cron scaler code
The current cron scaler code creates a cron object and starts it (which creates a goroutine and a lot of data to manage a cron engine) just so that it can find the next activation time. It also re-parses the cron strings on each iteration. This update only parses on creation of the trigger, then uses the cron schedule object directly to get the next activation time.
Checklist
- [X] I have verified that my change is according to the deprecations & breaking changes policy
- [X] Changelog has been updated and is aligned with our changelog requirements
- [X] Commits are signed with Developer Certificate of Origin (DCO - learn more)