Skip to content

Commit

Permalink
Handle student & coach event emailing as separate
Browse files Browse the repository at this point in the history
Send them both in the background, separately. This should help with
the timeouts we have sometimes on Heroku.
  • Loading branch information
gnclmorais committed Oct 25, 2024
1 parent c6e0a61 commit c20c8dd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/invitation_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ def invite_students_to_event(event, chapter)
EventInvitationMailer.invite_student(event, student, invitation).deliver_now if invitation.save
end
end
handle_asynchronously :invite_students_to_event

def invite_coaches_to_event(event, chapter)
chapter_coaches(chapter).each do |coach|
invitation = Invitation.new(event: event, member: coach, role: 'Coach')
EventInvitationMailer.invite_coach(event, coach, invitation).deliver_now if invitation.save
end
end
handle_asynchronously :invite_coaches_to_event

def chapter_students(chapter)
Member.in_group(chapter.groups.students)
Expand Down

0 comments on commit c20c8dd

Please sign in to comment.