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.

only include links if less than 10K imported

Steven Teycba073c8886c
diff --git a/apps/web/app/api/cron/import/bitly/utils.ts b/apps/web/app/api/cron/import/bitly/utils.ts
index 745ef8dd6b..065573ad3a 100644
--- a/apps/web/app/api/cron/import/bitly/utils.ts
+++ b/apps/web/app/api/cron/import/bitly/utils.ts
@@ -197,22 +197,25 @@ export const importLinksFromBitly = async ({
},
},
},
- links: {
- select: {
- domain: true,
- key: true,
- createdAt: true,
- },
- where: {
- domain: {
- in: domains,
+ // only include links if less than 10,000 links have been imported
+ ...(count < 10_000 && {
+ links: {
+ select: {
+ domain: true,
+ key: true,
+ createdAt: true,
+ },
+ where: {
+ domain: {
+ in: domains,
+ },
+ },
+ take: 5,
+ orderBy: {
+ createdAt: "desc",
},
},
- take: 5,
- orderBy: {
- createdAt: "desc",
- },
- },
+ }),
},
});
const ownerEmail = workspace?.users[0].user.email ?? "";