The monthly report, generated while nobody waits
Reports are big, slow and bursty — the three things a synchronous request handles worst. Queue it, merge the sections, get a webhook when the file is on the CDN.
Why it goes wrong
A report is not one page. It is twelve sections, forty charts and a client who clicks twice.
The gateway gives up at 30s
A 90-page report with lazy-loaded charts takes longer than any HTTP proxy will keep the connection open.
Charts render empty
The screenshot lands before the animation finishes and you ship a report full of blank canvases.
Sections live on different pages
Cover, summary, appendix and terms are separate routes, so you end up gluing four PDFs together in a library that mangles fonts.
Everyone exports on the 1st
Bulk jobs starve the one report a customer is staring at, because your queue has no notion of who is waiting.
Queue it, merge it, ship it
One async job merges every section into a single continuously paginated PDF, waits for the charts, and calls you back.
Merge the routes you already have. Pagination and the table of contents run across the whole document.
Wait for a signal your charts emit — an event or a data attribute — instead of guessing with a delay.
Go async and answer your user in 40ms with a job id. The webhook arrives when the file is ready.
Mark priority on interactive exports so the nightly batch never blocks them.
90 pages
merged from four routes, still one credit
40ms
to accept the job and answer your user
24h
of webhook retries if your endpoint is down