Automation Pipeline3 min read

My Auto-Publisher Was Built to Stop on an Empty Queue

I moved publishing to a daily 11:00 launchd job. It ranks by per-hook-type retention and falls back to a fixed order when there is no data. Here is why an empty queue is a deliberate no-op.

#launchd#automation#publishing-queue#retention#solo-dev
A publish job stopping at an empty queue, contrasted with a ranking that falls back to a fixed order
An empty queue is designed to be a normal no-op, not a failure.

Every day at 11:00, one item from the queue

Rendering a video script and mp4 and actually publishing it were separate steps. The publishing half was done by hand whenever I opened a session. I moved it to a daily 11:00 launchd job.

There are two pieces. One is a queue-filling script I run in a session: it puts rendered scripts and mp4 files into a per-channel queue file. The other is a publish script that runs daily: it picks the top-ranked item, publishes it, and records it in a published file. The cap is one per channel per day (DAILY_CAP=1). It also dedups, so the same item cannot go out twice, and it logs each run.

Ranking uses per-hook-type viewer retention: compare how far viewers watch for each type, and publish the higher one first. If a type has no retention data, the ranking falls back to a fixed order: loss, skepticism, reversal, novelty.

The first question automation forces on you is this one: what does your auto-publish job do on a day when there is nothing to publish?

I did not make the empty queue a failure

When the queue is empty, the job does nothing and exits. No error, no warning. The next session refills the queue and publishing resumes from there.

I could have had the job generate new scripts to fill the gap. But if a publish job starts creating content unattended just because the queue ran dry, unreviewed output can go out where nobody is looking. So it only publishes items that are already rendered and verified. Unattended script generation is not part of it.

What would you do with an empty day? I decided that a day with no post is better than a day with an unverified post.

Self-check

  • Have you decided whether your publish job ends with an error or quietly when the queue is empty?
  • Do you have a fixed fallback order for when the ranking metric has no data yet?
  • Is there any path by which a job running while nobody watches can create or publish something unverified?

The honest part

This is a record from when I built the setup, so there are no operating results yet. I have no data showing that retention-based ranking beats the fixed order, and I have not checked whether each hook type has enough samples. I do not know if one per day is the right cap. Refilling the queue still needs me in a session, so if I do not open one, the job keeps doing nothing. How long that gap can get is something I will only learn by running it.

Related