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.

remove comment

Steven Teydbc91b67f03c
diff --git a/apps/web/app/(ee)/api/cron/domains/delete/route.ts b/apps/web/app/(ee)/api/cron/domains/delete/route.ts
index 33954d330d..adfc1a89ac 100644
--- a/apps/web/app/(ee)/api/cron/domains/delete/route.ts
+++ b/apps/web/app/(ee)/api/cron/domains/delete/route.ts
@@ -1,3 +1,4 @@
+import { queueDomainDeletion } from "@/lib/api/domains/queue";
import { handleAndReturnErrorResponse } from "@/lib/api/errors";
import { linkCache } from "@/lib/api/links/cache";
import { limiter } from "@/lib/cron/limiter";
@@ -109,26 +110,26 @@ export async function POST(req: Request) {
console.log("remainingLinks", remainingLinks);
- // if (remainingLinks > 0) {
- // await queueDomainDeletion({
- // domain,
- // delay: 2,
- // });
- // return new Response(
- // `Deleted ${links.length} links, ${remainingLinks} remaining. Starting next batch...`,
- // );
- // }
-
- // // After all links are deleted, delete the domain and image
- // await Promise.all([
- // prisma.domain.delete({
- // where: {
- // slug: domain,
- // },
- // }),
- // domainRecord.logo &&
- // storage.delete(domainRecord.logo.replace(`${R2_URL}/`, "")),
- // ]);
+ if (remainingLinks > 0) {
+ await queueDomainDeletion({
+ domain,
+ delay: 2,
+ });
+ return new Response(
+ `Deleted ${links.length} links, ${remainingLinks} remaining. Starting next batch...`,
+ );
+ }
+
+ // After all links are deleted, delete the domain and image
+ await Promise.all([
+ prisma.domain.delete({
+ where: {
+ slug: domain,
+ },
+ }),
+ domainRecord.logo &&
+ storage.delete(domainRecord.logo.replace(`${R2_URL}/`, "")),
+ ]);
return new Response(
`Deleted ${links.length} links, no more links remaining. Domain deleted.`,