The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Return 0 when the program no longer exists.
Rafi2f6d2ebee0c3
diff --git a/apps/web/lib/api/fraud/release-all-hold-commissions.ts b/apps/web/lib/api/fraud/release-all-hold-commissions.tsindex 88cf643f6d..ed58a007e6 100644--- a/apps/web/lib/api/fraud/release-all-hold-commissions.ts+++ b/apps/web/lib/api/fraud/release-all-hold-commissions.ts@@ -12,7 +12,7 @@ export async function releaseAllHoldCommissions({}: {programId: string;}) {- const program = await prisma.program.findUniqueOrThrow({+ const program = await prisma.program.findUnique({where: {id: programId,},@@ -21,6 +21,15 @@ export async function releaseAllHoldCommissions({},});+ // The program can be deleted before this cron runs.+ // Return 0 so that QStash does not retry the job.+ if (!program) {+ console.log(+ `Program ${programId} not found, skipping hold commission release`,+ );+ return 0;+ }+let totalReleased = 0;const partnerIdsToSync = new Set<string>();