Queues: hand slow jobs to a to-do list so the page answers straight away
Queues (Cloudflare Queues for background work between Workers)
What it is
Cloudflare Queues is a durable to-do list for Workers. One Worker, the producer, drops a small message onto a queue, such as "build today's digest" or "check this website". Another Worker, the consumer, picks those messages up a moment later and does the actual work in the background. Cloudflare keeps the messages safe in between, so nothing is lost if the consumer is busy.
You connect it with bindings, the same way as KV, D1, R2, and Workers AI. In the producer's wrangler.toml you add a [[queues.producers]] block naming the queue and a binding such as JOBS, and the script calls env.JOBS.send({ ... }). In the consumer's wrangler.toml you add a [[queues.consumers]] block, and the script has a queue() handler (alongside the usual fetch()) that receives a batch of messages and works through them.
It suits anything that should not make a visitor wait: sending emails, handling webhooks from other services, processing an upload, or splitting one big job into many small ones. If a message fails, Queues retries it automatically a set number of times, and you can send repeated failures to a separate dead-letter queue to look at later. Check the dashboard and pricing page for the current plan limits before relying on it.
Why it matters
It keeps your web pages fast. Without a queue, a Worker that sends an email or calls a slow outside service makes the visitor watch a spinner until that finishes. With a queue, the Worker says "got it", adds a message, and replies straight away; the slow part happens behind the scenes.
It gives you retries for free. Outside services hiccup. Rather than you writing your own "try again in a minute" code, Queues redelivers a failed message, which is ideal for small apps that send digests, process uploads, or poke other websites.
It separates "accept the request" from "do the heavy work". That makes each Worker simpler, and lets you fan one action out into many jobs, such as one message per site to check, without any single request running too long.
On your account
From your own setup: a weekly digest Worker could, when its Cron Trigger fires, put one message "build this week's digest" on a queue and finish immediately; a consumer Worker would then gather the stories, write the page, and retry by itself if a news source was slow.
Your freehosts.kosan.xyz catalogue or the VPS heartbeat checks are another natural fit: one cron run could queue a separate message for each site to check, and the consumer would test each one in turn, so one slow site does not hold up the rest.
This tutor, cloudflare.kosan.xyz, served by the cloudflare-tutor Worker, uses no queue; its lessons are fixed text in worker.js. Nothing in this lesson creates a queue or binds one to cloudflare-tutor, ainews, aiweekly, or any other app.
Do this yourself
These stay in the dashboard, on your side. This site does not change DNS, routes, or other Workers.
- In the Cloudflare dashboard, open Workers & Pages, then Queues (wording may differ slightly), and just look: note whether any queues already exist and what the page shows for each; if you want to try one, create a throwaway queue named exactly tutor-queues-lesson, open it to see its settings and message counts, then delete that same queue. Do not bind it to, or create producers or consumers for, cloudflare-tutor, ainews, aiweekly, or any live app, and do not deploy anything.