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

Suggestion: Minimal support for implementing retention policies #450

Open
m000 opened this issue Aug 10, 2023 · 1 comment
Open

Suggestion: Minimal support for implementing retention policies #450

m000 opened this issue Aug 10, 2023 · 1 comment

Comments

@m000
Copy link

m000 commented Aug 10, 2023

Hello, we've been using Post Office for a while now. For some of the emails we send, we need to implement a retention policy, so that we don't collect addresses of customers for longer than it is needed.

Is there a recommended way to implement this with the current codebase?

Some thoughts we had on how to implement this:

  • Filtering on Log entries, and deleting sent emails based on our retention policy. However, we need to tell apart the emails for which the retention policy applies from those that it doesn't.
  • Setting a header for these emails would help to tell types of emails apart. However, Email.headers field is not indexed, so filtering on the field would be O(N). Also,
  • Setting both the header and the retention period in Email.headers. Again, the field will need to be indexed.
  • Adding an indexed Email.retain_until DateTime field or Email.retain_for DurationField field and a manager method to support the functionality. These fields could be set when sending the email, and used by a periodic job to implement the retention policy. However, this requires changes to the Email model (i.e. forking the project and/or making a PR to upstream). If this sounds like a useful addition that would be accepted, we're willing to put the work needed for it.

Any thoughts on how we should proceed or other approaches that we haven't considered are welcome.

@selwin
Copy link
Collaborator

selwin commented Aug 21, 2023

Hi, I think some kind of retention policies would be a great addition. For starters, I like the idea of adding retain_until DateField. Would accept a PR for this.

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

No branches or pull requests

2 participants