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

[CORL-3035] Create a notifications expiry index (TTL) #4525

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

nick-funk
Copy link
Contributor

What does this PR do?

  • creates a TTL index that allows notification documents to expire over time so they don't pile up in our database
    • has a filter for DSA type notifications to never delete them so we are nice to our European clients
  • adds a flag to mark some notifications as DSA specific

These changes will impact:

  • commenters
  • moderators
  • admins
  • developers

What changes to the GraphQL/Database Schema does this PR introduce?

None

Does this PR introduce any new environment variables or feature flags?

No

If any indexes were added, were they added to INDEXES.md?

The following was added to INDEXES.md:

db.notifications.createIndex({ createdAt: 1 }, { partialFilterExpression: { isDSA: { $eq: null } }, expireAfterSeconds: 30 * 24 * 60 * 60 });

How do I test this PR?

  • Add the above index but set the expireAfterSeconds to 30 (or similar)

  • Post some comments and reply to them with other commenters

  • See your notifications show up

  • When the expiry time has passed, check again, they should now be gone

    • Can also check in Mongo that they have been deleted
  • Report some comments as illegal

  • Process the reports by rejecting or completing the DSA reports

  • See the notifications appear in the notification area for the respective users

  • Wait the TTL for deletion

  • See the DSA notifications are never deleted

Were any tests migrated to React Testing Library?

No

How do we deploy this PR?

Merge into epic branch.
Deploy the above mentioned index when deploying the notifications release to clients.

does not delete notifications marked as DSA because we want them
to always remain visible for European users.
@nick-funk nick-funk requested a review from kabeaty February 5, 2024 16:14
@nick-funk nick-funk merged commit 4d001da into epic/notifications Feb 6, 2024
2 checks passed
@nick-funk nick-funk deleted the feat/CORL-3035-notifications-ttl branch February 6, 2024 19:32
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.

2 participants