Using One Cron Parser Everywhere With Rust and Saffron
The development of Cron Triggers on Cloudflare Workers involved tackling a problem related to parsers and cron expression format, which varies between platforms and isn't standardized by a governing body. To solve this issue, the team wrote their backend service in Rust, leveraging its ecosystem for working across multiple languages. They also developed a parser called 'saffron', which supported all the extensions they wanted while leaving off other field extensions like seconds and years. The UI had different requirements, leading to the use of two JavaScript libraries for displaying information about given cron expressions. However, these libraries sometimes allowed users to add schedules that would be rejected by the API on submit, causing a non-optimal user experience. To address this issue, they synced the API and backend with another schedule runner entrypoint and added a validation endpoint to the API. They also made plans to remedy the situation by working on saffron to fill in for the one library holding them back in the UI. The quest for the one true parser continues as they aim to bring the number of parsers down from two to one, with one source of truth for the entire stack.
Company
Cloudflare
Date published
Dec. 25, 2020
Author(s)
Aaron Loyd
Word count
2469
Hacker News points
5
Language
English