The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
final changes, space crons out a bit
Steven Tey438838442615
diff --git a/apps/web/app/(ee)/api/cron/cleanup/expired-tokens/route.ts b/apps/web/app/(ee)/api/cron/cleanup/expired-tokens/route.tsindex cf5710af62..e02abe2c32 100644--- a/apps/web/app/(ee)/api/cron/cleanup/expired-tokens/route.ts+++ b/apps/web/app/(ee)/api/cron/cleanup/expired-tokens/route.ts@@ -6,19 +6,19 @@ import { NextResponse } from "next/server";export const dynamic = "force-dynamic";-// tokens expired 1 hour ago-const cutoff = new Date(Date.now() - 1000 * 60 * 60);-// This route is used to remove expired tokens from the database// 1. VerificationToken// 2. EmailVerificationToken// 3. PasswordResetToken-// Runs once every hour (0 * * * *)+// Runs once every day at 02:00:00 AM UTC (0 2 * * *)// GET /api/cron/cleanup/expired-tokensexport async function GET(req: Request) {try {await verifyVercelSignature(req);+ // tokens expired 1 day ago+ const cutoff = new Date(Date.now() - 1000 * 60 * 60 * 24);+const [verificationTokens, emailVerificationTokens, passwordResetTokens] =await Promise.all([prisma.verificationToken.deleteMany({diff --git a/apps/web/app/(ee)/api/cron/cleanup/link-retention/route.ts b/apps/web/app/(ee)/api/cron/cleanup/link-retention/route.tsindex af46583ba3..ef6324558a 100644--- a/apps/web/app/(ee)/api/cron/cleanup/link-retention/route.ts+++ b/apps/web/app/(ee)/api/cron/cleanup/link-retention/route.ts@@ -12,7 +12,7 @@ import { z } from "zod";export const dynamic = "force-dynamic";// This route is used to delete old links for domains with linkRetentionDays set-// Runs once a day at 00:00:00 UTC (0 0 * * *)+// Runs once every 12 hours (0 */12 * * *)// GET /api/cron/cleanup/link-retentionasync function handler(req: Request) {try {@@ -137,6 +137,9 @@ async function deleteOldLinks();++processedBatches;++ // sleep for 250ms+ await new Promise((resolve) => setTimeout(resolve, 250));}// Only schedule another run if we hit the batch limit AND we found a full batchdiff --git a/apps/web/app/(ee)/api/cron/online-presence/youtube/route.ts b/apps/web/app/(ee)/api/cron/online-presence/youtube/route.tsindex 8127fd778b..eea8b89de8 100644--- a/apps/web/app/(ee)/api/cron/online-presence/youtube/route.ts+++ b/apps/web/app/(ee)/api/cron/online-presence/youtube/route.ts@@ -8,7 +8,7 @@ export const dynamic = "force-dynamic";/*This route is used to update youtube stats for youtubeVerified partners- Runs once a day at 12:00 AM UTC (cron expression: 0 0 * * *)+ Runs once a day at 06:00 AM UTC (cron expression: 0 6 * * *)*/export async function GET(req: Request) {try {diff --git a/apps/web/vercel.json b/apps/web/vercel.jsonindex 0d1238e9d6..dbcfefa29d 100644--- a/apps/web/vercel.json+++ b/apps/web/vercel.json@@ -42,7 +42,7 @@},{"path": "/api/cron/online-presence/youtube",- "schedule": "0 0 * * *"+ "schedule": "0 6 * * *"},{"path": "/api/cron/cleanup/e2e-tests",@@ -50,11 +50,11 @@},{"path": "/api/cron/cleanup/expired-tokens",- "schedule": "0 * * * *"+ "schedule": "0 2 * * *"},{"path": "/api/cron/cleanup/link-retention",- "schedule": "0 0 * * *"+ "schedule": "0 */12 * * *"}],"functions": {