One of the very few things most developers lazily evaluate is Regex (regular expressions). There are several memes about it, but they're undeniably useful when pattern matching is important. The second, in my opinion, is the cron expression. Less scary than regex, a bit more predictable, but still lazily evaluated.
Coincidentally, they're also useful for pattern matching—just in the context of time. Recurring times, if I might.
A project I've worked on for a while now relies heavily on background workers/jobs to execute several flows that contribute crucially to the overall system. In fact, there are probably five times as many jobs as there are route groupings (user routes, debit routes, etc.) in the codebase. You can already tell where this is going, because background jobs need cron expressions to work. They need to know when to run and how often to run. In other words, they need a pattern.
One such job is what we loosely call the mandate-debit-readiness job. Its responsibility is to identify mandates that are ready for debit and update their state accordingly. It was supposed to run every five minutes and had been doing so for almost three months.
Or so we thought.







