Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emailSender function doesn't use a queue #91

Closed
SophiaWhiteMA opened this issue Sep 2, 2021 · 3 comments · Fixed by #101
Closed

emailSender function doesn't use a queue #91

SophiaWhiteMA opened this issue Sep 2, 2021 · 3 comments · Fixed by #101

Comments

@SophiaWhiteMA
Copy link
Contributor

The email system could be made easier to use and more reliable by replacing the current system with an email queue. When the emailSender function is called, the email is put into a queue rather than being immediately sent.

Example of how the system currently works (taken from helpers/userhelper.js):

timeoutMS += 500;
setTimeout(() => {
    emailSender(status.email, "New Infringment Assigned", getInfringmentEmailBody(status.firstName, status.lastName, infringment, status.infringments.length), null, "[email protected]");
}, timeoutMS);

the timeoutMS variable is intended to avoid overwhelming the email system. Rather than code this multiple time across the back end, it makes more sense to build this functionality into a queue system.

@SophiaWhiteMA SophiaWhiteMA changed the title Emailsender doesn't use a queue emailSender function doesn't use a queue Sep 2, 2021
@one-community
Copy link
Member

one-community commented Sep 2, 2021 via email

@SophiaWhiteMA
Copy link
Contributor Author

SophiaWhiteMA commented Sep 4, 2021

Are there any potential downsides to this? None

Would it still work with gmail or use a different email? Same email

What are the benefits? You’ve said easier and more reliable, how?

  • It eliminates possible programmer error
  • Eliminates the possibility that the emailSender function is called at the same time by two separate threads which can result in one or more emails failing to be sent
  • Code becomes significantly easier to maintain and this approach is much better in terms of programming practice / conventions

@one-community
Copy link
Member

one-community commented Sep 4, 2021 via email

@SophiaWhiteMA SophiaWhiteMA linked a pull request Sep 9, 2021 that will close this issue
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 a pull request may close this issue.

2 participants