Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Read the program once before the release loop.

Rafif2abaee3b05e
diff --git a/apps/web/lib/api/fraud/release-all-hold-commissions.ts b/apps/web/lib/api/fraud/release-all-hold-commissions.ts
index 5d5e4c8ddf..c84a415b8a 100644
--- a/apps/web/lib/api/fraud/release-all-hold-commissions.ts
+++ b/apps/web/lib/api/fraud/release-all-hold-commissions.ts
@@ -10,6 +10,15 @@ export async function releaseAllHoldCommissions({
}: {
programId: string;
}) {
+ const program = await prisma.program.findUniqueOrThrow({
+ where: {
+ id: programId,
+ },
+ select: {
+ workspaceId: true,
+ },
+ });
+
let totalReleased = 0;
while (true) {
@@ -52,15 +61,6 @@ export async function releaseAllHoldCommissions({
totalReleased += updatedCount;
- const program = await prisma.program.findUniqueOrThrow({
- where: {
- id: programId,
- },
- select: {
- workspaceId: true,
- },
- });
-
const partnerIds = Array.from(
new Set(commissionsToRelease.map((c) => c.partnerId)),
);