From c20c8dda630c60c5b32a4404a95f1e1f1620dd96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Morais?= <385232+gnclmorais@users.noreply.github.com> Date: Fri, 25 Oct 2024 22:58:15 +0200 Subject: [PATCH] Handle student & coach event emailing as separate Send them both in the background, separately. This should help with the timeouts we have sometimes on Heroku. --- app/models/invitation_manager.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/invitation_manager.rb b/app/models/invitation_manager.rb index f65031273..7e300739f 100644 --- a/app/models/invitation_manager.rb +++ b/app/models/invitation_manager.rb @@ -33,6 +33,7 @@ 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| @@ -40,6 +41,7 @@ def invite_coaches_to_event(event, chapter) 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)