Requests are not always the right place for work
If an operation sends email, generates reports, syncs analytics, or calls a slow third-party API, it probably does not belong in the user's request path.
await queue.publish("invoice.created", { invoiceId })
A queue gives you retries, backpressure, and room to recover.
- Accept the request
- Store the durable intent
- Process async
- Report status clearly
That structure keeps users from waiting on work they do not need immediately.