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.

Update backfill-short-links.ts

Steven Teybf4f6a4e30e5
diff --git a/apps/web/scripts/backfill-short-links.ts b/apps/web/scripts/backfill-short-links.ts
index 86fc8e4b58..cf32ef2d2f 100644
--- a/apps/web/scripts/backfill-short-links.ts
+++ b/apps/web/scripts/backfill-short-links.ts
@@ -3,7 +3,7 @@ import { linkConstructor } from "@dub/utils";
import "dotenv-flow/config";
async function main() {
- const batchSize = 1000;
+ const batchSize = 500;
let processedCount = 0;
while (true) {
@@ -23,7 +23,7 @@ async function main() {
break;
}
- await prisma.$transaction(
+ const results = await Promise.allSettled(
links.map((link) =>
prisma.link.update({
where: { id: link.id },
@@ -34,7 +34,7 @@ async function main() {
),
);
- processedCount += links.length;
+ processedCount += results.filter((r) => r.status === "fulfilled").length;
console.log(`Processed ${processedCount} links`);
}