fix: extended time delta for mailing

This commit is contained in:
Riccardo
2024-06-29 08:37:27 +02:00
parent 939360f1fc
commit 1ef2f12601
2 changed files with 3 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
## Future improvements
- Cron every 10 minutes: people are more likely to open the newsletter if delivered around the time when they subscribed (if cron becomes not enough, then the cost of sending all the emails might be a bigger issue)
- Cron every 10 minutes and redure time delta to 10 minutes: people are more likely to open the newsletter if delivered around the time when they subscribed (if cron becomes not enough, then the cost of sending all the emails might be a bigger issue)
## Some resources used

View File

@@ -12,7 +12,7 @@ import { NextRequest } from 'next/server';
import { Resend } from 'resend';
const ONE_DAY_IN_MS = 1000 * 60 * 60 * 24;
const TEN_MINUTES_IN_MS = 1000 * 10 * 60;
const DELTA_MINUTES_IN_MS = 1000 * 60 * 60;
export async function GET(request: NextRequest) {
if (
@@ -32,7 +32,7 @@ export async function GET(request: NextRequest) {
OR: [
{
lastMail: {
lt: new Date(Date.now() - ONE_DAY_IN_MS + TEN_MINUTES_IN_MS) // 24h - 10m
lt: new Date(Date.now() - ONE_DAY_IN_MS + DELTA_MINUTES_IN_MS) // 24h - 60m
}
},
{