Skip to content

Stop Gmail limit incidents: account-scoped BullMQ sending queue - #169

Merged
ralyodio merged 3 commits into
mainfrom
fix/email-queue-gmail-resend
Oct 30, 2026
Merged

ralyodio merged 3 commits into
mainfrom
fix/email-queue-gmail-resend

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Incident

Gmail SMTP headers show EHLO myna.local, matching packages/core/src/core/smtp.ts. A burst of ~413 newsletter messages in about an hour preceded Gmail's sending block.

Implementation

  • Introduce independently publishable @profullstack/email-queue (BullMQ + Redis) workspace package.
  • Gmail budget 100 per rolling 24h and one send per 10 minutes; Resend initial budget 1000 per 24h and one send per second. Sender account limits enforced by shared Redis; no fallback to direct sending.
  • Route normal MyNaPoster mail provider selection for Gmail SMTP / Resend through queue, including myna newsletter, myna email, and standard provider call sites.
  • Send newsletter one recipient per job, deduped by issue and contact; retain completion receipt for 30d.
  • Disable automatic retries of ambiguous deliveries and do not put mail-provider secrets in Redis.

Pre-merge checklist

  • Run bun install to regenerate bun.lock and verify Bun build/typecheck/tests.
  • Integration-test with Redis and fake Gmail SMTP/Resend, including simultaneous workers and restart/reconciliation.
  • Configure EMAIL_QUEUE_REDIS_URL everywhere sending Gmail or Resend before deployment; fail-closed otherwise.
  • Review limits against provider account plans; workers must not accidentally start while Gmail ban is in force.
  • Publish workspace package independently for use in other repositories.

Draft because this change has not yet been tested against a live Redis/Bun environment.

@ralyodio
ralyodio marked this pull request as ready for review October 30, 2026 11:47
@ralyodio
ralyodio merged commit 2107c4a into main Oct 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant