Short answer: let the cron trigger enqueue a small, repeatable command, then let a queue worker deliver each customer digest. A 15-minute scheduler limit is fine when no individual invocation owns the whole report. The useful guarantee is a recorded handoff, not a heroic timeout.

A small decision matrix for weekly delivery

Design What it can prove Where it fits Trade-off
Cron calls the report directly The process started A tiny, read-only task A timeout can hide partial work
Cron enqueues one batch The batch was handed off Uniform, short reports One poison item can delay the batch
Cron records a run and enqueues customer jobs Each customer has a traceable attempt Active-customer digests Requires a ledger and reconciliation

For a B2B SaaS digest, I use the third row. The trigger writes a run record, creates one message per active customer, and exits. A worker owns data fetching, rendering, and delivery. That split keeps the scheduler's execution window boring and makes the business result inspectable.

This is a revenue-per-hour decision. Queue mechanics are undifferentiated plumbing; I want them managed or isolated so one person can spend the week shipping product. The ledger is worth keeping in application code because it answers the question support actually asks: “Did Acme's Monday report send?”

What delivery guarantee does the queue really provide?

Most queues provide at-least-once delivery. A message may appear again after a worker has sent the email but before it has acknowledged the message. A FIFO queue can preserve ordering and, with a deduplication window, reduce duplicates, but it cannot make an external email provider exactly-once. AWS describes those FIFO properties and their limits in its queue documentation.

So I define two separate facts: enqueued means the scheduler committed a message, and sent means the delivery provider accepted the final payload. A retry changes attempts; it must not create a second business event. The idempotency key joins the scheduled run and customer ID, and the delivery adapter stores that key before acknowledging work.

There is a catch. A per-customer job is only safe if its inputs are stable enough to replay. Store the report version or a snapshot pointer in the message, rather than serializing a giant report into it. If the worker sees the same key, it returns the prior result. That behavior is more valuable than squeezing another minute out of the cron runtime.

How should a cron trigger enqueue Node.js work for long-running cleanup reports?

Use the trigger as a coordinator, not as the worker. This TypeScript example uses generic interfaces so the same state machine can sit over a hosted queue, a database-backed queue, or a self-managed broker.

type DigestJob = { runId: string; customerId: string; snapshotId: string; }; async function scheduleDigest(now: Date): Promise<void> { const runId = `weekly:${now.toISOString().slice(0, 10)}`; const customers = await customerStore.activeIds(); await ledger.insertIfAbsent({ runId, status: "enqueuing", total: customers.length }); for (const customerId of customers) { const snapshotId = await reportStore.freezeInputs(customerId, runId); await queue.send({ runId, customerId, snapshotId } satisfies DigestJob); } await ledger.markEnqueued(runId); } async function work(job: DigestJob): Promise<void> { const key = `${job.runId}:${job.customerId}`; if (await ledger.wasSent(key)) return; const report = await reportStore.render(job.snapshotId); await delivery.sendEmail(job.customerId, report, { idempotencyKey: key }); await ledger.markSent(key); } 

The loop is intentionally plain. In production, enqueue in bounded pages and record the last successful page. A crash after page three should resume at page four, not silently claim that all customers were handled. The worker should renew its lease while rendering, cap retries, and move a repeatedly failing item to a dead-letter queue with the run ID attached.

Node.js is a good fit for this coordination because the trigger does little synchronous work. It is not a reason to keep a 40-minute report inside one process. Break expensive cleanup into retryable units, and make each unit observable.

Where do scheduled jobs fail after the trigger appears healthy?

The first failure mode is an apparently successful timeout. The scheduler waits 15 minutes, stops waiting, and the enqueue may already be committed. If an operator retries manually without checking the ledger, two weekly runs enter the queue. A deterministic run ID plus an insert-if-absent constraint turns that ambiguity into a visible state.

The second is a worker crash at the worst possible line: after the provider accepted an email, before the queue acknowledgement. The next delivery sees the same idempotency key and records a duplicate attempt without sending again. Test this exact point. It is a five-minute fault injection that exposes a whole class of expensive support tickets.

That is the contract.

The useful test matrix is wider than a happy-path unit test. Start a run with ten customers, kill the worker after rendering customer four, and let the lease expire. The replay should produce four recorded attempts, no second email for customer four, and six untouched messages. Then pause the delivery provider for twelve minutes and watch backlog age, retry count, and dead-letter movement. Finally, deploy a new message schema while an old worker is still draining; the old worker must reject or ignore fields it does not understand without marking the job sent. These checks cost less than a support incident because they exercise the boundaries where state changes hands. I keep the fixture data small and deterministic, so I can run the scenario locally before a weekly release and compare the ledger rows as plain text. It is not glamorous. It is the part that lets a solo operator trust an automated customer promise.

The third is stale membership. “Active customers” changes while a long enqueue loop runs. Freezing the customer set, or recording a membership version, gives the digest a defined population. Otherwise a customer can be absent simply because their subscription changed between page reads.

I once assumed a longer timeout would solve the handoff problem. It only made the failure harder to locate. Your mileage may vary with queue lease defaults, but the invariant stays the same: every customer has one run ID, one idempotency key, and a final state that can be queried.

When is a queue the wrong alternative?

Do not add a queue for a maintenance query that finishes in seconds, has no customer-visible side effect, and can be rerun safely. A direct cron call is easier to operate there. A hosted workflow scheduler is also reasonable when infrequent runs, retained logs, and a small delay matter more than per-customer throughput; GitHub's schedule event documentation is a useful example of that model.

The queue is not suitable when nobody watches backlog age, lease expirations, or dead-letter volume. Choose the simpler path, or make monitoring part of the same feature before shipping it. The operational burden is real: retries need backoff, schemas need versioning, and a replay tool needs authorization.

For a weekly digest, my decision rule is narrow: direct execution for bounded work, one queue message per independently retryable customer, and a ledger when a delivery dispute costs more than the ledger costs to maintain. That rule leaves room to change infrastructure later without changing the customer-facing contract.

Ship weekly. Keep the boring parts boring.

References

Further reading