Message Queue
Don't make the user stare at a spinner while generating this huge report. Put the job into a message queue and let background workers process it.
Long-running work is tied to the page request; after an interruption, task state is unclear.
Before: the page waits for all background work: After the user clicks Export, one request queries data, builds the file, and uploads it. A slow step can leave the page spinning or time out, and the user has no durable task status to check later.
Enqueue the work and return status through one task ID: The API creates export_104, enqueues its parameters and ID, and returns that ID. A worker marks the same task processing, then stores either a file location or readable failure. The page shows queued, processing, completed, or failed under that ID. Enqueued means accepted, not completed.
Verify evidence across the whole path: Match export_104 across the API response, queued message, worker log, and final UI state. Retry a failed task and confirm duplicate delivery does not create two files. A single 'message enqueued' log does not prove completion.
You can say this to an AI Agent
“This Excel export blocks the request too long. Make it asynchronous: create and enqueue a job, return its ID immediately, and have the worker update queued, processing, completed, or failed under the same ID. Make duplicate delivery safe, then verify both a successful export and a worker failure.
Select page elements for precise AI edits
Click a button, text, or card, note the change, then copy its exact location to AI.
Open Selector Pro website↗