The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
small fix
Kiran Ka2d486d61ed4
diff --git a/apps/web/app/(ee)/api/bounties/route.ts b/apps/web/app/(ee)/api/bounties/route.tsindex d4f4e01c60..008e6dab73 100644--- a/apps/web/app/(ee)/api/bounties/route.ts+++ b/apps/web/app/(ee)/api/bounties/route.ts@@ -20,7 +20,7 @@ import { prisma } from "@dub/prisma";import { Workflow } from "@dub/prisma/client";import { APP_DOMAIN_WITH_NGROK } from "@dub/utils";import { waitUntil } from "@vercel/functions";-import { differenceInMilliseconds } from "date-fns";+import { differenceInMinutes } from "date-fns";import { NextResponse } from "next/server";// GET /api/bounties - get all bounties for a program@@ -152,9 +152,8 @@ export const POST = withWorkspace(});// Calculate when the bounty will start (in seconds, minus 10 minutes for early trigger)- const diffMs = differenceInMilliseconds(bounty.startsAt, new Date());- let totalSeconds = Math.ceil(diffMs / 1000) - 10 * 60;- totalSeconds = Math.max(totalSeconds, 0);+ let diffMinutes = differenceInMinutes(bounty.startsAt, new Date());+ diffMinutes = Math.max(diffMinutes - 10, 0);waitUntil(Promise.allSettled([@@ -169,7 +168,7 @@ export const POST = withWorkspace(body: {bountyId: bounty.id,},- delay: totalSeconds,+ delay: diffMinutes * 60,}),]),);diff --git a/apps/web/app/(ee)/api/cron/bounties/published/route.ts b/apps/web/app/(ee)/api/cron/bounties/published/route.tsindex eb346d4ddc..d1f79a3db5 100644--- a/apps/web/app/(ee)/api/cron/bounties/published/route.ts+++ b/apps/web/app/(ee)/api/cron/bounties/published/route.ts@@ -3,6 +3,7 @@ import { qstash } from "@/lib/cron";import { verifyQstashSignature } from "@/lib/cron/verify-qstash";import { prisma } from "@dub/prisma";import { APP_DOMAIN_WITH_NGROK, log } from "@dub/utils";+import { differenceInMinutes } from "date-fns";import { z } from "zod";import { logAndRespond } from "../../utils";@@ -45,9 +46,7 @@ export async function POST(req: Request) {});}- // Check if bounty start date is at least 10 minutes in the past- const diffMs = Date.now() - bounty.startsAt.getTime();- const diffMinutes = diffMs / (1000 * 60);+ let diffMinutes = differenceInMinutes(bounty.startsAt, new Date());if (diffMinutes >= 10) {await qstash.publishJSON({@@ -55,7 +54,7 @@ export async function POST(req: Request) {body: {bountyId,},- delay: "5m",+ delay: (diffMinutes - 10) * 60,});return logAndRespond(