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

ADD opt-in email notifications on events #126

Open
wabscale opened this issue Jun 27, 2021 · 1 comment
Open

ADD opt-in email notifications on events #126

wabscale opened this issue Jun 27, 2021 · 1 comment
Labels

Comments

@wabscale
Copy link
Collaborator

wabscale commented Jun 27, 2021

Like:

  • An assignment release
  • An assignment about to be due
  • Lecture slides added
  • Due date change

It is unclear to me if we should use keep it simple with an smtp server, or go more complex with integrating the gmail api.

The plan with that task:

  • Add some card to the profile page that has a bunch of checkboxes for opting into different email events (like when assignment are released, about to be due without a submission, lecture notes published, notifications from instructors...)
  • Extend the anubis.models.InCourse to include boolean values for these email preferences. (We put it on the InCourse table so preferences are specific to the course)
  • Add endpoints to anubis.views.public.profile for changing the opt-in email values. (Maybe some admin views too for changing a whole class email preferences).
  • Add rpc functions for sending out email notifications.
  • Use the scheduling features of rq to schedule email notifications functions. We could then schedule assignment notifications to run when those two views I mentioned earlier are run.
  • We probably need to also add some kind of notification tracking as a table in the database. Without that we may accidentally send notifications twice, or not at all if something gets wonked when we are sending.

There are a couple of gotchas that we will need to handle:

  • If we are scheduling notification rpc jobs, we will need to confirm that the timing is still correct when the job is run.
  • We also need this system to be fault tolerant. The rpc job queues are stored in redis. Redis is meant to not be persistent in Anubis. If redis is restarted or the container is lost or destroyed for any reason, everything on it will be lost (including jobs in the queues). Normally jobs live in queues for no more than 60-120 seconds, so there is normally no issue. My worry with scheduling jobs is that we would need to be able to detect and re-enqueue scheduled jobs if they are lost.

An alternative to scheduling notification rpc jobs is just adding a function to detect when notifications need to be sent out, and put it in a k8s CronJob that could be run every 5 minutes or so. We could then enqueue jobs to send out the notifications from there. This setup would be much more fault tolerant than scheduling rpc notification jobs.

Then the last thing is that I have not decided if I want to use the google gmail api, or just a simple smtp server setup. In Anubis version 0.0.1 back in January of 2020 there was no website. I sent out emails for every submission to students via a simple smtp server setup. We ended up getting rate limited by gmail in the like 3 hours before the deadline in that first assignment. i.e. emails were not being delivered to students. Then alternatively maintaining google api credentials is just annoying. I have done it in k8s before and could copy some code over, but it is just more annoying than something simple like an smtp server.

@wabscale wabscale added feature New feature or request frontend backend labels Jun 27, 2021
@github-actions
Copy link

Issue is stale

@github-actions github-actions bot added the stale label Aug 28, 2021
@wabscale wabscale mentioned this issue Dec 18, 2021
36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant