Autoretto.
← All posts
How it works · September 7, 2026 · 4 min read · Autoretto Daily

The scheduler, the cron, and the double-publish guard

Every release run starts with a simple question: is there a slot that should have already been published? For a long time we answered that question with a future timestamp. The run would wait until the clock reached the scheduled time. That worked when the wait was short. It failed when a run started after the slot had already passed. It failed even harder when two runs started close together. Two runs could start within seconds of each other. Both would check the same scheduled time. Both would find that the time had arrived. Both would start uploading. The result was an occasional YouTube video that appeared twice. So we changed the model.

The scheduler now keys off the most recent past slot inside a catch-up window. When a run begins, it scans the calendar for the channel. It ignores every slot that is still in the future. It also ignores any slot that is farther back than the catch-up window. What remains is the set of slots that are late but not too late. From that set, the scheduler picks the one with the latest scheduled time. That becomes the target. The run only publishes if that target exists and has not already been released.

The catch-up window is the safety band. It is measured in hours, not days. Its length is not fixed. It depends on the gap between scheduled slots. For a channel that uploads once a day, the window might reach back a few hours from the current moment. For a channel that uploads twice a week, the window can be wider. The point is to give the system time to notice a missing slot and still do something about it. A window also keeps old slots from bubbling up weeks later. If a slot is too old, it is simply abandoned. That frees the channel to focus on the next scheduled release.

Here is a concrete picture. A channel has a slot set for 09:00. The renderer hangs and nothing finishes. At 10:30 a new run appears. The scheduler looks back. The 09:00 slot is the most recent past slot that sits inside the window. The stamp says no release has been sent for that time. The run publishes it. Now imagine the same failure but the next run does not happen until 18:00. The 09:00 slot is still the most recent past slot, but it is outside the catch-up window. The scheduler decides the slot is too stale to chase. It skips it and waits for the next future slot to become due.

The second piece is the hourly cron. Autoretto runs mostly in a browser, but uploads should not depend on a tab staying open. So a server-side process wakes up every hour. For each connected channel, it asks the same question a manual run would ask. Is there a most recent past slot inside the catch-up window? Does the last-release stamp say it is unpublished? If yes, the cron starts a release run. This is how a channel publishes while you sleep, while your laptop is closed, or while you are away for the weekend. The cron acts as the always-on safety net.

The third piece is the last-release stamp. It is a timestamp saved on the channel. Every successful publish updates the stamp to the scheduled time of the slot that was just released. Before any run starts, it reads that stamp. Then it compares the stamp to the candidate slot. If the stamp is earlier than the slot, the slot has not been published. The run can proceed. If the stamp is the same as the slot or later, the slot is already done. The run stops. This check happens before the upload, not after.

Overlapping runs are where the stamp earns its keep. The hourly cron and a manual run can start in the same minute. Both pick the same 09:00 slot. Both read the old stamp. Both begin the upload process. One finishes first. It updates the stamp to 09:00. The second run is still in its early checks. When it re-reads the stamp, it sees 09:00 and knows the slot is handled. It cancels its own upload. The stamp update is the arbiter. Without it, the second run would go all the way to YouTube and push a duplicate video.

This set of changes is invisible from the outside. You still set a schedule and let Autoretto do the publishing. But the inside is more forgiving now. A missed run can catch up within the window. An hourly cron handles the cases when nobody is watching. A simple timestamp prevents the expensive mistake of a double upload. It is not glamorous. It is the kind of plumbing that makes scheduled music releases feel calm.