Skip to content

Account for every SES recipient in email send-rate limiting #455

Description

@coderabbitai

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions