Summary
The BullMQ limiter in apps/web/src/server/service/email-queue-service.ts counts one queue job per unit of the configured SES send rate. executeEmail passes to, cc, and bcc to sendRawEmail, but SES counts each recipient against the send-rate quota. A multi-recipient send can therefore use more SES quota than the limiter reserves.
Required change
Enforce a shared recipient-aware send-rate budget for each SES region near sendRawEmail. Count all to, cc, and bcc recipients in each send. Coordinate the budget across workers and application instances, and account for the transactional and marketing quotas without exceeding the regional SES rate. Preserve the existing throttling retry behavior.
Acceptance criteria
- A send with multiple
to, cc, or bcc recipients consumes one budget unit per recipient.
- Concurrent workers and application instances share the applicable regional budget.
- Tests cover multi-recipient jobs, concurrent sends, and retry behavior after SES throttling.
- The regional rate remains bounded when transactional and marketing sends run together.
Tracked separately from PR #454: #454
Review discussion: #454 (comment)
Requested by @sefasenturk95.
Summary
The BullMQ limiter in
apps/web/src/server/service/email-queue-service.tscounts one queue job per unit of the configured SES send rate.executeEmailpassesto,cc, andbcctosendRawEmail, but SES counts each recipient against the send-rate quota. A multi-recipient send can therefore use more SES quota than the limiter reserves.Required change
Enforce a shared recipient-aware send-rate budget for each SES region near
sendRawEmail. Count allto,cc, andbccrecipients in each send. Coordinate the budget across workers and application instances, and account for the transactional and marketing quotas without exceeding the regional SES rate. Preserve the existing throttling retry behavior.Acceptance criteria
to,cc, orbccrecipients consumes one budget unit per recipient.Tracked separately from PR #454: #454
Review discussion: #454 (comment)
Requested by @sefasenturk95.