@@ -4,7 +4,7 @@ import { includeTags } from "@/lib/api/links/include-tags";
44import { generateRandomName } from "@/lib/names" ;
55import { createPartnerCommission } from "@/lib/partners/create-partner-commission" ;
66import { isStored , storage } from "@/lib/storage" ;
7- import { getClickEvent , recordLead , recordLeadSync } from "@/lib/tinybird" ;
7+ import { getClickEvent , recordLead } from "@/lib/tinybird" ;
88import { logConversionEvent } from "@/lib/tinybird/log-conversion-events" ;
99import { ClickEventTB , WebhookPartner , WorkspaceProps } from "@/lib/types" ;
1010import { redis } from "@/lib/upstash" ;
@@ -214,9 +214,6 @@ export const trackLead = async ({
214214 : leadEventPayload ;
215215
216216 await Promise . all ( [
217- // Use recordLeadSync which waits for the operation to complete
218- recordLeadSync ( leadEventPayload ) ,
219-
220217 // Cache the latest lead event for 5 minutes because the ingested event is not available immediately on Tinybird
221218 // we're setting two keys because we want to support the use case where the customer has multiple lead events
222219 redis . set ( `leadCache:${ customer . id } ` , cacheLeadEventPayload , {
@@ -235,9 +232,8 @@ export const trackLead = async ({
235232
236233 waitUntil (
237234 ( async ( ) => {
238- // for async mode, record the lead event in the background
239- // for deferred mode, defer the lead event creation to a subsequent request
240- if ( mode === "async" ) {
235+ // for deferred mode, we defer the lead event creation to a subsequent request
236+ if ( mode !== "deferred" ) {
241237 await recordLead ( createLeadEventPayload ( customer . id ) ) ;
242238 }
243239
0 commit comments