Learning Bytes

Note ·

I needed my blog site to rebuild whenever I created or edited a byte post in Notion. Notion doesn’t send webhooks, so I poll: every 10 minutes, a job asks Notion “anything changed?” and triggers a rebuild if yes. For example, I may have drafted a post in Notion (this wont get pushed), checked it and changed the status to Published (this will get pushed to the blog)

The obvious approach is to remember when you last checked, then ask “anything since then?” But that means storing a timestamp somewhere and reading it back next time — more moving parts, more things to break.

The trick I used instead:

  • Check every 10 minutes, but ask about the last 15 minutes.
  • Each run overlaps the previous one by 5 minutes.
  • If a run is late or gets skipped, the next one still catches whatever it missed.
  • No state to store. No “when did I last run” logic. Nothing to corrupt.

Why the overlap matters: scheduled jobs aren’t perfectly on time. They drift, they skip, they queue up under load. If your window exactly matches your interval, a missed run = a missed edit, forever. Overlap is cheap insurance.

The trade-off: an edit landing in the overlap window might trigger two rebuilds instead of one. For a site that builds in under a minute, that’s fine. Deleting an entire category of bug is worth one extra build.

The general pattern: anywhere you’d reach for “remember the last time I did X,” ask whether overlapping windows would work instead. Often they do, and the code gets dramatically simpler.