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.

some cleanup

Kiran Ke2065b6373cc
diff --git a/apps/web/app/api/cron/workspaces/delete/route.ts b/apps/web/app/api/cron/workspaces/delete/route.ts
index aa88511047..c1d824f258 100644
--- a/apps/web/app/api/cron/workspaces/delete/route.ts
+++ b/apps/web/app/api/cron/workspaces/delete/route.ts
@@ -42,18 +42,20 @@ export async function POST(req: Request) {
});
if (links.length > 0) {
- await prisma.link.deleteMany({
- where: {
- id: {
- in: links.map((link) => link.id),
+ await Promise.all([
+ prisma.link.deleteMany({
+ where: {
+ id: {
+ in: links.map((link) => link.id),
+ },
},
- },
- });
+ }),
- await bulkDeleteLinks({
- workspaceId: workspace.id,
- links,
- });
+ bulkDeleteLinks({
+ workspaceId: workspace.id,
+ links,
+ }),
+ ]);
}
const remainingLinks = await prisma.link.count({
diff --git a/apps/web/lib/api/workspaces.ts b/apps/web/lib/api/workspaces.ts
index 0741765e3e..6e154eb550 100644
--- a/apps/web/lib/api/workspaces.ts
+++ b/apps/web/lib/api/workspaces.ts
@@ -10,7 +10,9 @@ import {
LEGAL_WORKSPACE_ID,
R2_URL,
} from "@dub/utils";
+import { waitUntil } from "@vercel/functions";
import { qstash } from "../cron";
+import { markDomainAsDeleted } from "./domains";
import { linkCache } from "./links/cache";
export async function deleteWorkspace(
@@ -61,9 +63,11 @@ export async function deleteWorkspace(
}),
]);
- await queueWorkspaceDeletion({
- workspaceId: workspace.id,
- });
+ waitUntil(
+ queueWorkspaceDeletion({
+ workspaceId: workspace.id,
+ }),
+ );
}
export async function deleteWorkspaceAdmin(