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 create-link.ts

Kiran K299625fe2d6b
diff --git a/apps/web/lib/api/links/create-link.ts b/apps/web/lib/api/links/create-link.ts
index cbc53e4c93..f10270b778 100644
--- a/apps/web/lib/api/links/create-link.ts
+++ b/apps/web/lib/api/links/create-link.ts
@@ -143,7 +143,7 @@ export async function createLink(link: ProcessedLinkProps) {
partnerId: response.partnerId,
});
- Promise.allSettled([
+ await Promise.allSettled([
// cache link in Redis
linkCache.set({
...response,
@@ -154,6 +154,7 @@ export async function createLink(link: ProcessedLinkProps) {
// record link in Tinybird
recordLink(response),
+
// Upload image to R2 and update the link with the uploaded image URL when
// proxy is enabled and image is set and is not a hosted image URL
...(proxy && image && isNotHostedImage(image)
@@ -174,6 +175,7 @@ export async function createLink(link: ProcessedLinkProps) {
}),
]
: []),
+
// delete public links after 30 mins
!response.userId &&
qstash.publishJSON({
@@ -184,6 +186,7 @@ export async function createLink(link: ProcessedLinkProps) {
linkId: response.id,
},
}),
+
// update links usage for workspace
link.projectId &&
updateLinksUsage({