fix: two API processes by default and the worker drains its queue

The API ran as one uvicorn process, so a slow 150 MB PDF check at checkout
held every other request; WEB_CONCURRENCY now comes from API_WORKERS
(default 2, 1 restores one process) and the api /tmp grows to 512 MiB for
two checks at once. The worker delivered one outbox job per second; it now
drains up to 50 per pass before its periodic tasks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-09 16:24:07 -03:00
parent 63af984e83
commit 74ac2c978b
6 changed files with 60 additions and 4 deletions

View File

@@ -223,6 +223,15 @@ If a service is refused, the contract uses other codes: set `CORREIOS_COD_PAC`
or `CORREIOS_COD_SEDEX`. Correios price by the box, so `JADLOG_CAIXA_CM` and the
package weights must be set (they already are for Jadlog).
## 9. API processes
`API_WORKERS` is how many uvicorn processes the API container runs (default 2;
`1` runs one process, as before). More than one keeps a slow checkout, such as
a PDF of up to 150 MB being checked, from holding every other request in the
only process; the API's `/tmp` is sized for two such checks at once. It applies
to the API only, never to the worker. Set it in the stack's environment and
redeploy.
## Current blocker
This is the final deployment shape, but it is not authorized for production