Wait, Bang vs. Bang, Wait: Subtleties in Elixir Cron Scripts

This post is just a quick recap of how to do the cron-like task of executing code on a periodic basis in Elixir. In other languages, you might implement this using a sleep function, but behold this warning from ye olde Elixir docs:

For almost all situations where you would use sleep/1 in Elixir, there is likely a more correct, faster and precise way of achieving the same with message passing.

Like vampires, Elixir never sleeps! Remember what Joe Armstrong said of Erlang (Elixir’s engine): “write once