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 redundant `queuePartnerSearchSync`

Steven Teyb047add30709
diff --git a/apps/web/app/(ee)/api/cron/domains/update/route.ts b/apps/web/app/(ee)/api/cron/domains/update/route.ts
index 92c5d37816..651219e652 100644
--- a/apps/web/app/(ee)/api/cron/domains/update/route.ts
+++ b/apps/web/app/(ee)/api/cron/domains/update/route.ts
@@ -6,7 +6,6 @@ import { handleAndReturnErrorResponse } from "@/lib/api/errors";
import { linkCache } from "@/lib/api/links/cache";
import { includeProgramEnrollment } from "@/lib/api/links/include-program-enrollment";
import { includeTags } from "@/lib/api/links/include-tags";
-import { queuePartnerSearchSyncForLinks } from "@/lib/api/partners/queue-partner-search-sync";
import { verifyQstashSignature } from "@/lib/cron/verify-qstash";
import { prisma } from "@/lib/prisma";
import { recordLink } from "@/lib/tinybird";
@@ -102,10 +101,6 @@ export async function POST(req: Request) {
linkCache.expireMany(linksToUpdate),
]);
- // Queue an index update because the domain change rewrote each link's
- // shortLink. Queued after updateShortLinks above, which performs the rewrite
- await queuePartnerSearchSyncForLinks(updatedLinks);
-
const response = await queueDomainUpdate({
...payload,
startingAfter: linksToUpdate[linksToUpdate.length - 1].id,
diff --git a/apps/web/app/(ee)/api/cron/groups/sync-utm/route.ts b/apps/web/app/(ee)/api/cron/groups/sync-utm/route.ts
index a021991a84..9d30e7c5b7 100644
--- a/apps/web/app/(ee)/api/cron/groups/sync-utm/route.ts
+++ b/apps/web/app/(ee)/api/cron/groups/sync-utm/route.ts
@@ -1,6 +1,5 @@
import { handleAndReturnErrorResponse } from "@/lib/api/errors";
import { linkCache } from "@/lib/api/links/cache";
-import { queuePartnerSearchSync } from "@/lib/api/partners/queue-partner-search-sync";
import { extractUtmParams } from "@/lib/api/utm/extract-utm-params";
import { qstash } from "@/lib/cron";
import { verifyQstashSignature } from "@/lib/cron/verify-qstash";
@@ -127,12 +126,6 @@ export async function POST(req: Request) {
const redisRes = await linkCache.expireMany(linksToUpdate);
console.log(`Updated Redis cache: ${JSON.stringify(redisRes, null, 2)}`);
- // Queue an index update because the UTM template rewrote each link's
- // destination URL.
- await queuePartnerSearchSync({
- enrollmentIds: programEnrollments.map(({ id }) => id),
- });
-
if (programEnrollments.length === PAGE_SIZE) {
await qstash.publishJSON({
url: `${APP_DOMAIN_WITH_NGROK}/api/cron/groups/sync-utm`,
diff --git a/apps/web/app/(ee)/api/cron/groups/update-default-links/route.ts b/apps/web/app/(ee)/api/cron/groups/update-default-links/route.ts
index 470c53d236..66b8abd757 100644
--- a/apps/web/app/(ee)/api/cron/groups/update-default-links/route.ts
+++ b/apps/web/app/(ee)/api/cron/groups/update-default-links/route.ts
@@ -1,6 +1,5 @@
import { handleAndReturnErrorResponse } from "@/lib/api/errors";
import { linkCache } from "@/lib/api/links/cache";
-import { queuePartnerSearchSyncForLinks } from "@/lib/api/partners/queue-partner-search-sync";
import { extractUtmParams } from "@/lib/api/utm/extract-utm-params";
import { qstash } from "@/lib/cron";
import { verifyQstashSignature } from "@/lib/cron/verify-qstash";
@@ -198,12 +197,6 @@ export async function POST(req: Request) {
}),
),
);
-
- // Queue an index update because the default link change rewrote
- // destination URLs.
- await queuePartnerSearchSyncForLinks(
- linksToUpdate.map(({ owner }) => owner),
- );
}
console.log(
diff --git a/apps/web/lib/api/links/bulk-create-links.ts b/apps/web/lib/api/links/bulk-create-links.ts
index aa96386be7..fffd7f48f8 100644
--- a/apps/web/lib/api/links/bulk-create-links.ts
+++ b/apps/web/lib/api/links/bulk-create-links.ts
@@ -236,9 +236,7 @@ export async function bulkCreateLinks({
linksCount: links.length,
timestamp: new Date().toISOString(),
}),
- // Queue an index update because the new links carry searchable
- // shortLinks. Default delay, since a new short link is how people find
- // that partner.
+ // Queue an index update because the new links carry searchable link keys
queuePartnerSearchSyncForLinks(createdLinksData),
]),
);
diff --git a/apps/web/lib/api/links/bulk-delete-links.ts b/apps/web/lib/api/links/bulk-delete-links.ts
index 0beb96dac5..151b865829 100644
--- a/apps/web/lib/api/links/bulk-delete-links.ts
+++ b/apps/web/lib/api/links/bulk-delete-links.ts
@@ -64,8 +64,7 @@ export async function bulkDeleteLinks(
// Queue an index update because the links were deleted. The enrollment
// outlives them, so the document is re-serialized without them.
- queuePartnerSearchSyncForLinks(links, {
- }),
+ queuePartnerSearchSyncForLinks(links),
]),
);
}
diff --git a/apps/web/lib/api/links/complete-ab-tests.ts b/apps/web/lib/api/links/complete-ab-tests.ts
index c114b592b0..7175441e9b 100644
--- a/apps/web/lib/api/links/complete-ab-tests.ts
+++ b/apps/web/lib/api/links/complete-ab-tests.ts
@@ -1,5 +1,4 @@
import { getAnalytics } from "@/lib/analytics/get-analytics";
-import { queuePartnerSearchSyncForLinks } from "@/lib/api/partners/queue-partner-search-sync";
import { prisma } from "@/lib/prisma";
import { recordLink } from "@/lib/tinybird";
import { sendWorkspaceWebhook } from "@/lib/webhook/publish";
@@ -79,9 +78,6 @@ export async function completeABTests(link: Link) {
linkCache.set(response),
// record the link
recordLink(response),
- // Queue an index update because the winning variant replaced the
- // destination URL.
- queuePartnerSearchSyncForLinks([response]),
// send a link.updated webhook to the workspace
response.project &&
sendWorkspaceWebhook({
diff --git a/apps/web/lib/api/links/update-link.ts b/apps/web/lib/api/links/update-link.ts
index 92a94cf898..a3f9013d83 100644
--- a/apps/web/lib/api/links/update-link.ts
+++ b/apps/web/lib/api/links/update-link.ts
@@ -211,8 +211,7 @@ export async function updateLink({
// Queue an index update because the edit can change the destination URL
// or move the link. Both owners, so a former one is re-serialized
// without it.
- queuePartnerSearchSyncForLinks([oldLink, response], {
- }),
+ queuePartnerSearchSyncForLinks([oldLink, response]),
// If proxy is true and image is not stored in R2, upload image to R2
proxy &&
diff --git a/apps/web/tests/partners/turbopuffer-partner-search-provider.test.ts b/apps/web/tests/partners/turbopuffer-partner-search-provider.test.ts
index e3a9409c76..cbc217b6d8 100644
--- a/apps/web/tests/partners/turbopuffer-partner-search-provider.test.ts
+++ b/apps/web/tests/partners/turbopuffer-partner-search-provider.test.ts
@@ -94,7 +94,12 @@ describe("Turbopuffer partner search provider", () => {
);
// Description, platforms, and links stay out, so a name cannot be
// out-weighted by how much else a partner has.
- for (const value of ["affiliate marketer", "youtube", "@rafi", "rafi-link"]) {
+ for (const value of [
+ "affiliate marketer",
+ "youtube",
+ "@rafi",
+ "rafi-link",
+ ]) {
expect(row.identityText).not.toContain(value);
}
// ContainsAllTokens reads the BM25 index, so no text attribute needs a
@@ -128,8 +133,8 @@ describe("Turbopuffer partner search provider", () => {
it("pins a tokenizer that splits URLs into their components", async () => {
// The default tokenizer keeps a URL as one token, so "scottdigital" cannot
- // match "https://www.scottdigital-42.techcorp.io", and websites, short
- // links, and destination URLs are all searchable here.
+ // match "https://www.scottdigital-42.techcorp.io"
+ // and websites + partner links are all searchable here
await createProvider().upsert([document]);
const [{ schema }] = mocks.write.mock.calls[0];