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.

Fix tripe customer update in the importer

Kiran Ke761fac76f31
diff --git a/apps/web/lib/partnerstack/update-stripe-customers.ts b/apps/web/lib/partnerstack/update-stripe-customers.ts
index 2eb575ff34..708cc3251d 100644
--- a/apps/web/lib/partnerstack/update-stripe-customers.ts
+++ b/apps/web/lib/partnerstack/update-stripe-customers.ts
@@ -59,7 +59,7 @@ export async function updateStripeCustomers(
email: true,
},
orderBy: {
- createdAt: "asc",
+ id: "asc",
},
take: CUSTOMERS_PER_BATCH,
skip: currentStartingAfter ? 1 : 0,
@@ -75,7 +75,7 @@ export async function updateStripeCustomers(
break;
}
- await Promise.all(
+ await Promise.allSettled(
customers.map((customer) =>
searchStripeAndUpdateCustomer({
workspace,
@@ -173,4 +173,8 @@ async function searchStripeAndUpdateCustomer({
stripeCustomerId: stripeCustomer.id,
},
});
+
+ console.log(
+ `Updated customer ${customer.id} with Stripe customer ID ${stripeCustomer.id}`,
+ );
}
diff --git a/apps/web/lib/tolt/update-stripe-customers.ts b/apps/web/lib/tolt/update-stripe-customers.ts
index 736f4ac4ec..ed4cbd80b3 100644
--- a/apps/web/lib/tolt/update-stripe-customers.ts
+++ b/apps/web/lib/tolt/update-stripe-customers.ts
@@ -57,7 +57,7 @@ export async function updateStripeCustomers({
email: true,
},
orderBy: {
- createdAt: "asc",
+ id: "asc",
},
take: CUSTOMERS_PER_BATCH,
skip: startingAfter ? 1 : 0,
@@ -73,7 +73,7 @@ export async function updateStripeCustomers({
break;
}
- await Promise.all(
+ await Promise.allSettled(
customers.map((customer) =>
searchStripeAndUpdateCustomer({
workspace,
@@ -150,4 +150,8 @@ async function searchStripeAndUpdateCustomer({
stripeCustomerId: stripeCustomer.id,
},
});
+
+ console.log(
+ `Updated customer ${customer.id} with Stripe customer ID ${stripeCustomer.id}`,
+ );
}