Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Optimize mass sending of emails for meeting notifications #749

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

TheEgghead27
Copy link
Member

Scheduling meetings for large clubs (~200-300+ members) will lead to NetworkErrors due to the request taking over 1 minute to resolve.
This is because we send out all emails in sequence, rather than in parallel using Promise.all(). By leveraging asynchronous functions to their full potential, we can reduce the response time for all clubs by a factor of 1/2 or better.

Here some average request times (in seconds, as measured by Firefox Network Monitor)

Club Before Patches After Patches
NHD (~35-40 emails) 9.90 2.97-4.05
Red Cross (~358 emails) > 1min (Timeout 502) 27-31

Attempt to optimize the delay for creating a meeting
Before this commit, it took 9.90sec for ~40 emails.
Examine if this runs up against rate limits
Appears that this patch does not lead to rate limit issues, even on the
largest test data set, Red Cross (> 300 members).
Add this functionality to alterMeeting, which *timed out after 1 minute*
due to how long the unpatched code took.
Copy link
Contributor

@randysim randysim left a comment

Choose a reason for hiding this comment

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

lgtm

@randysim randysim merged commit 8daf44f into master Oct 23, 2023
3 of 4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants