From today you can write a post now and have Disbigle publish it later, from 5 minutes to 90 days ahead. prealpinux (@prealpinux@disbigle.com) proposed it in issue #28. It is online on app.disbigle.com and in the API; the Android and iPhone apps will get it later.
This article has two parts: how to use it, and then how it works inside, for those who like to look under the hood.
How to use it
- In the box where you write, press the clock button and choose the date and time. The time is the one of your device: the browser sends it to the server in UTC.
- The Publish button becomes Schedule.
- Everything a normal post has works: up to 4 photos, polls, content warning, sensitive content, the five visibilities (public, unlisted, followers, aspects, direct), groups, replies and language.
- The new Scheduled page in the menu lists your posts in the order they will come out, with a preview of text, photos and poll and their visibility. From there you can change the time or delete them.
If a post cannot come out, for example because the post it replies to was deleted or you left the group, it stays on the page marked Not published, with the reason. The menu shows a badge with the number of these posts. Choose a new time to try again.
The limits are the same as Mastodon's: at most 300 posts waiting per person, and at most 25 on the same day (UTC).
Under the hood: a table of its own
A scheduled post does not live in the posts table, but in a separate PostgreSQL table, scheduled_posts (migration 0035). Timelines, search and canView, the single function that decides who can see a post, never meet a post before it is published: it becomes a normal post only when it comes out. The queries of the timelines do not change at all.
CREATE TABLE scheduled_posts (
id uuid PRIMARY KEY, -- UUIDv7
actor_id uuid NOT NULL REFERENCES actors(id) ON DELETE CASCADE,
scheduled_at timestamptz NOT NULL,
params jsonb NOT NULL, -- the same request as a normal post
claimed_at timestamptz,
failed_at timestamptz,
error text NOT NULL DEFAULT '',
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX scheduled_posts_due_idx ON scheduled_posts (scheduled_at) WHERE failed_at IS NULL;
CREATE INDEX scheduled_posts_actor_idx ON scheduled_posts (actor_id, scheduled_at);params holds the same request that creates a normal post, validated with the same Zod schema, createPostRequestSchema: when scheduling and again when publishing. The partial index scheduled_posts_due_idx covers only the posts still to publish; the one on (actor_id, scheduled_at) serves the personal page.
The worker, once a minute
Disbigle's worker runs the publish-scheduled-posts job every 60 seconds. A Redis lock (SET key NX PX) makes sure that, with several workers, only one runs it. Each run makes one indexed query for the posts whose time has passed, the oldest first, 100 at most: if thousands of people choose the same minute, they come out over a few runs, a delay of seconds or minutes, not a load spike.
Before publishing, each row is claimed in a single statement. FOR UPDATE SKIP LOCKED means that two workers can never take the same post:
UPDATE scheduled_posts SET claimed_at = now()
WHERE id IN (
SELECT id FROM scheduled_posts
WHERE scheduled_at <= now() AND failed_at IS NULL AND claimed_at IS NULL
ORDER BY scheduled_at
LIMIT 100
FOR UPDATE SKIP LOCKED
)
RETURNING *;Then each post goes through createPost, the same function as the posts written by hand. ActivityPub federation (Fedify) and diaspora*, mentions, notifications, hashtags, FEP-1b12 groups and link previews work with no duplicated code: the published post cannot be told apart from one written at that moment. Once published, the row is deleted.
Never twice
If publishing fails, the row stays with failed_at and an error the author can read, and it is not retried on its own. If the worker stops halfway, because of a restart or a crash, a claim older than 10 minutes is marked as interrupted instead of being published again: there is no way to know whether the post had already come out. The author decides, with a note to check the profile before trying again.
Checked while you write
Everything that can be checked is checked when you schedule, not when the post comes out, so you see errors while you are still writing: the post you reply to must be visible to you, you must be a member of the group, the aspects must be yours, a direct message needs at least one mention, and the photos must be yours and not already used.
People on other servers that you mention are looked up with WebFinger when you schedule: the worker that publishes the post does not make network lookups.
Photos that wait
An hourly job deletes the photos uploaded and never used after 24 hours. Those of a scheduled post are left out: the query checks jsonb_exists(params->'mediaIds', id), so a post set two months ahead comes out with its photos. If you delete the scheduled post, its photos go back to being unused and are removed after a day.
The API, also for Mastodon apps
Disbigle's own API and the Mastodon-compatible API both support scheduling. Third-party apps that can schedule posts on Mastodon work with Disbigle too:
# Mastodon API: scheduled_at on a normal post, answered with a ScheduledStatus
curl -X POST https://app.disbigle.com/api/v1/statuses \
-H "Authorization: Bearer $TOKEN" \
-d status="Good morning, fediverse" \
-d scheduled_at=2026-12-01T08:00:00Z
GET /api/v1/scheduled_statuses # list
GET /api/v1/scheduled_statuses/:id # one
PUT /api/v1/scheduled_statuses/:id # move it (Mastodon); PATCH in the web API
DELETE /api/v1/scheduled_statuses/:id # delete itWhat it costs the server
One indexed query a minute, a few kilobytes for each post waiting, and no change to the hot paths, timelines and notifications. The feature is covered by automated tests for the server, the Mastodon API and the web interface, and it has been checked in production.
Thanks, prealpinux! Issue #28 is closed. Found a bug or have an idea? Open an issue.
Comments from the fediverse
Reply to the post with your Disbigle, Mastodon or other fediverse account: your reply appears here.


Comments
No comments yet.