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

Feature/single time msg conf #306

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

ArthurErlich
Copy link

Sending E-Mail Notification Once

Addition for the frosh:monitor Command

This addition introduces a configuration feature to send an E-Mail notification only once within a specified time frame. The goal is to reduce spam by preventing repeated notifications when a mail has already been sent.

There are two settings:

  • Enable the option
  • Specify the time interval for the next E-Mail (TTL of the cache)
    image

To implement this, I moved the email-sending functionality to its own method to keep the code clean and maintainable.

Persistent E-Mail Sent Flag

To track when an E-Mail has been sent, I use the cache instead of the database. This approach avoids writing to the database or creating a migration if changes are needed later.

The cache is a suitable solution because we can simply check if the cache is set. If it isn't, the notification mail is sent and the cache key added.

I hope the use of the cache is acceptable in this context.

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 this pull request may close these issues.

1 participant