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.

Fixed cron bug

Steven Tey05b3b3f66c7a
diff --git a/lib/cron/domains.tsx b/lib/cron/domains.tsx
index d8b48160e0..9c1cd078d3 100644
--- a/lib/cron/domains.tsx
+++ b/lib/cron/domains.tsx
@@ -42,8 +42,12 @@ export const handleDomainUpdates = async (
}
if (invalidDays >= 30) {
- const hasLinks = await redis.exists(`${domain}:links`);
- if (hasLinks === 0) {
+ const existingLinks = await prisma.link.findMany({
+ where: {
+ domain,
+ },
+ });
+ if (existingLinks.length === 0) {
// only delete if there are no resources recorded (links, stats, etc.)
const ownerEmail = await getProjectOwnerEmail(projectSlug);
return await Promise.all([
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index b576706120..d714d557f8 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -4,12 +4,10 @@
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
- referentialIntegrity = "prisma"
}
generator client {
provider = "prisma-client-js"
- previewFeatures = ["referentialIntegrity"]
}
model User {