The worker sized its pool to leave room for only the APIs 10 default pg connections, but infra/pm2/api.config.cjs runs it as 2 cluster instances (20 total) and the realtime broadcaster holds one more. On a busy host the worker and API pools together could reach Postgres default max_connections, which is why session.findFirst() -- run on every authenticated request -- was the query that hit "too many clients already". dbConnectionBudget() now derives the worker pool cap from the APIs actual cluster size and pool size, plus headroom for admin/migration connections, instead of a hardcoded 80. Both are configurable (API_DB_POOL_SIZE, API_INSTANCES, DB_MAX_CONNECTIONS) for installs that tune Postgres or PM2 differently. Paperclip-Agent: José Alves (urlKey jos-alves; id 11179220-3cec-4f0f-880d-2771ff64fce8) Paperclip-Issue: BIT-31519 Paperclip-Run: f5442a27-6b3b-4c5a-a1ab-8b2b4177be7c