Skip to content

Commit

Permalink
Merge pull request #4525 from coralproject/feat/CORL-3035-notificatio…
Browse files Browse the repository at this point in the history
…ns-ttl

[CORL-3035] Create a notifications expiry index (TTL)
  • Loading branch information
nick-funk authored Feb 6, 2024
2 parents 4778b9f + c595752 commit 4d001da
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions INDEXES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ The goal of this document is to date-mark the indexes you add to support the cha

If you are releasing, you can use this readme to check all the indexes prior to the release you are deploying and have a good idea of what indexes you might need to deploy to Mongo along with your release of a new Coral Docker image to kubernetes.

## 2024-02-02

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

- This creates a TTL on non-DSA marked notifications that will delete them after 30 days
- The `partialFilterExpression` finds any notifications that aren't marked as `isDSA` so we don't delete important DSA notifications
- You can modify the expiry time by changing `expireAfterSeconds`

## 2023-11-24

```
Expand Down
2 changes: 2 additions & 0 deletions server/src/core/server/models/notifications/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export interface Notification extends TenantResource {
rejectionReason?: GQLREJECTION_REASON_CODE;
decisionDetails?: GQLNotificationDecisionDetails;
customReason?: string;

isDSA?: boolean;
}

type BaseConnectionInput = ConnectionInput<Notification>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ export class InternalNotificationContext {
grounds: legal ? legal.grounds : undefined,
explanation: legal ? legal.explanation : undefined,
},
isDSA: true,
});

return notification;
Expand Down Expand Up @@ -438,6 +439,7 @@ export class InternalNotificationContext {
grounds: legal.grounds,
explanation: legal.explanation,
},
isDSA: true,
});

return notification;
Expand Down

0 comments on commit 4d001da

Please sign in to comment.