fix: switch event invitations to async delivery to prevent timeout on large chapters - #2759
Merged
Merged
Conversation
mroderick
force-pushed
the
fix/event-invitation-timeout
branch
from
July 29, 2026 10:30
32dc788 to
ad426a3
Compare
… large chapters `InvitationManager#send_event_emails` sends one email at a time using `deliver_now` in a synchronous loop. For a chapter like London (~4,300 eligible members), this takes ~40 minutes — past both DelayedJob's 9-minute max run time and the Heroku Scheduler dyno timeout. Switch to `deliver_later` (matching the existing workshop pattern), so each email becomes its own DJ job with an independent 9-minute timeout. The outer job finishes in seconds (just creating records + enqueuing). Also: - Wrap the outer method in a Rollbar rescue so batch-level failures are visible in production without relying on silent DJ retries - Add tests for email delivery count and Rollbar error reporting Fixes #2758
mroderick
force-pushed
the
fix/event-invitation-timeout
branch
from
July 29, 2026 10:53
ad426a3 to
c3d4dce
Compare
mroderick
marked this pull request as ready for review
July 29, 2026 10:56
olleolleolle
approved these changes
Jul 30, 2026
olleolleolle
enabled auto-merge
July 30, 2026 08:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #2758
InvitationManager#send_event_emailssends one email at a time usingdeliver_nowin a synchronous loop. For a chapter like London (~4,300 eligible members), this takes ~40 minutes — past both DelayedJob's 9-minute max run time and the Heroku Scheduler dyno timeout.This PR switches to
deliver_later(matching the existing workshop pattern), so each email becomes its own DJ job with an independent 9-minute timeout. The outer job finishes in seconds (just creating records + enqueuing).Changes
app/services/invitation_manager.rb:deliver_nowtodeliver_laterin bothinvite_students_to_eventandinvite_coaches_to_event; wrap outer method in Rollbar rescue for production visibilityspec/services/invitation_manager_spec.rb: add tests for email delivery count and Rollbar error reportingTest coverage
1158 examples, 0 failures across the full suite.