Skip to content

feat: make async email delivery the default for all workshop invitations#2630

Merged
mroderick merged 3 commits into
codebar:masterfrom
mroderick:feature/default-async-email-delivery
May 29, 2026
Merged

feat: make async email delivery the default for all workshop invitations#2630
mroderick merged 3 commits into
codebar:masterfrom
mroderick:feature/default-async-email-delivery

Conversation

@mroderick
Copy link
Copy Markdown
Collaborator

@mroderick mroderick commented May 29, 2026

You can see the continued occurrence of this bug in https://app.rollbar.com/a/codebar-production/fix/item/codebar-production/692#detail

Summary

Follow-up to #2592 which introduced a feature flag for async email delivery, but left it unset in production. This meant London (and all other chapters) continued sending workshop invitations synchronously inside a single DelayedJob, causing timeouts at 540s on Heroku.

Changes

  • All workshop invitations now use deliver_later — removes the per-chapter conditional
  • Removes AsyncEmailConcern — no longer needed
  • Removes ASYNC_EMAIL_CHAPTER_IDS env var — clean up unused configuration

Why

  • London: ~5,439 students + ~1,981 coaches = ~7,420 subscribers
  • A single workshop can send 2,000–4,000 invitations
  • At ~200ms per email, 4,000 emails = ~800s > 540s timeout
  • With async delivery, each email is its own job (~1–2s each), so no single job exceeds the timeout

Affected Workshop Identified

From the production database, the most recent timeout occurred on:

Field Value
Workshop ID 3770
Chapter London (id: 1)
Workshop date 2026-06-03 18:30:00
Invitation log ID 130
Log started at 2026-05-28 12:34:17 UTC
Status running (stuck — never completed)
Emails sent before timeout 2,290

Three additional London workshops also have invitation logs stuck in running status from prior timeouts (workshop IDs 3759, 3750, and 3743).

Commits

  • feat: default workshop invitations to async email delivery
  • refactor: remove AsyncEmailConcern
  • chore: remove ASYNC_EMAIL_CHAPTER_IDS env var and config

Each commit is green with matching test changes.

Deployment note

Remove ASYNC_EMAIL_CHAPTER_IDS from Heroku config vars after deploy.

mroderick added 3 commits May 29, 2026 15:37
Replace conditional async/sync email delivery with async everywhere.
All workshop invitations, attendance reminders, and waiting list
notifications now use deliver_later regardless of chapter.

This is a follow-up to PR codebar#2592 which added the feature flag but
left it unset in production, causing London's bulk invitation jobs
to continue timing out at 540s on Heroku.
The conditional async email feature flag is no longer needed now that
all chapters use async delivery by default.
The feature flag is no longer needed. All workshop invitations now
use async delivery by default. Remove the environment variable from
production config when deploying.
@mroderick
Copy link
Copy Markdown
Collaborator Author

mroderick commented May 29, 2026

The async delivery was tested in the Brighton chapter in production (at least once) and worked just fine.

I don't know when the ASYNC_EMAIL_CHAPTER_IDS configuration was lost in production environment. I've been unable to find any log of configuration changes in Heroku, so we'll never know for certain why that is now absent.

@mroderick mroderick marked this pull request as ready for review May 29, 2026 13:51
@mroderick mroderick requested review from olleolleolle and till May 29, 2026 13:52
Copy link
Copy Markdown
Collaborator

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easier, more streamlined!

@mroderick mroderick merged commit 1de3983 into codebar:master May 29, 2026
14 of 15 checks passed
@mroderick mroderick deleted the feature/default-async-email-delivery branch May 29, 2026 14:38
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.

3 participants