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.

put in try catch

Steven Teyf9b55bd6fd6e
diff --git a/apps/web/lib/auth/workspace.ts b/apps/web/lib/auth/workspace.ts
index e187c746e2..793aeb56da 100644
--- a/apps/web/lib/auth/workspace.ts
+++ b/apps/web/lib/auth/workspace.ts
@@ -234,25 +234,29 @@ export const withWorkspace = (
waitUntil(
// update last used time for the token (only once every 15 minutes)
(async () => {
- const { success } = await ratelimit(1, "15 m").limit(
- `last-used-${hashedKey}`,
- );
-
- if (success) {
- const prismaArgs = {
- where: {
- hashedKey,
- },
- data: {
- lastUsed: new Date(),
- },
- };
-
- if (isRestrictedToken) {
- await prisma.restrictedToken.update(prismaArgs);
- } else {
- await prisma.token.update(prismaArgs);
+ try {
+ const { success } = await ratelimit(1, "15 m").limit(
+ `last-used-${hashedKey}`,
+ );
+
+ if (success) {
+ const prismaArgs = {
+ where: {
+ hashedKey,
+ },
+ data: {
+ lastUsed: new Date(),
+ },
+ };
+
+ if (isRestrictedToken) {
+ await prisma.restrictedToken.update(prismaArgs);
+ } else {
+ await prisma.token.update(prismaArgs);
+ }
}
+ } catch (error) {
+ console.error(error);
}
})(),
);