The Unfunny AlmanacObservationsfol. 43

chapter v · Blog

Your cron job will run twice

notes from the logbook

“clarity 2/5. hazy, but i'm writing it down anyway.”

It's one of the predictions on the front page, and the most reliable one. Any job that runs on a schedule will, sooner or later, run twice: a deploy overlaps, a lock expires early, a retry fires while the first attempt is still going.

When the job moves money, "twice" is the whole problem.

Plan for it

  • Give every run a key that says what it's for (this loan, this day), not when it started.
  • Write down that the key was used, in the same transaction as the work itself.
  • Make the second run notice the first one and stop, quietly.

None of this is new. It's just easy to skip on the first version, and expensive to add on the fifth.

This is a sample entry, here to show how the logbook works. The real ones come later.

← all observations