Skip to content

Per-ESP send-rate limiting (e.g. SES max send rate) #51

Closed

Description

@clbotdev

Background

The sequence worker runs with concurrency: 10 (mail/sequence-worker.ts:34), and transports are built with no rate limit (mail/transport.ts:166). Nothing throttles sends to an ESP's allowed rate.

Why it matters: Amazon SES enforces a per-account max send rate (often 14/s in new accounts) and rejects anything above it with Throttling. Other ESPs have similar limits. Large broadcasts then fail or churn through retries, and platforms that share one ESP account across tenants need a shared limit.

Proposed fix

  • Add a configurable msgs/sec rate per ESP config, defaulting from the provider (for SES, read GetSendQuota → MaxSendRate).
  • Enforce it across workers with a BullMQ limiter or a Redis token bucket.
  • Back off and retry on throttling errors.

Related: #5 (warmup handles daily volume ramp-up, not per-second rate).

Acceptance criteria

  • Sends per ESP config never exceed the configured rate across all workers.
  • Throttling errors are retried, not marked failed.
  • A test covers the limiter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestseverity: highMajor gap or broken flow for many users

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions