Skip to content

Commit

Permalink
Deal with multiple notifications
Browse files Browse the repository at this point in the history
 * attempt to make exipiration notifications work
 * remove unused constant
  • Loading branch information
SerpentBytes committed Apr 25, 2023
1 parent 06c04cd commit cb9d2b3
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions services/expiration/expiration-notification.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ declare global {
var __expiration_init__: boolean;
}

// constant for notification frequency in days
const NOTIFICATION_FREQUENCY = 7;

// name for the queue
const expirationNotificationQueueName = 'expiration-notification';

Expand Down Expand Up @@ -151,17 +148,7 @@ const getExpiringCertificates = () => {
lte: dayjs().add(30, 'd').toDate(),
},
status: 'issued',

OR: [
{
lastNotified: null,
},
{
lastNotified: dayjs()
.subtract(NOTIFICATION_FREQUENCY * 4, 'd')
.toDate(),
},
],
lastNotified: null,
},
include: { user: true },
});
Expand All @@ -173,16 +160,7 @@ const getExpiringDnsRecords = () => {
expiresAt: {
lte: dayjs().add(30, 'd').toDate(),
},
OR: [
{
lastNotified: null,
},
{
lastNotified: dayjs()
.subtract(NOTIFICATION_FREQUENCY * 4, 'd')
.toDate(),
},
],
lastNotified: null,
},
include: { user: true },
});
Expand Down

0 comments on commit cb9d2b3

Please sign in to comment.