Skip to content

Commit 09ec1f9

Browse files
authored
Merge pull request #49 from AJFrio/perf/optimize-stripe-price-creation-18404150179723580484
⚡ Parallelize Stripe price creation for product variants
2 parents 121a7f5 + bca45ce commit 09ec1f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/services/ProductStripeService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class ProductStripeService {
9191
}
9292

9393
// Create Stripe prices for each combination
94-
for (const combo of combinations) {
94+
await Promise.all(combinations.map(async (combo) => {
9595
const stripePrice = await this.stripe.createPrice({
9696
amount: combo.price,
9797
currency: productData.currency,
@@ -118,7 +118,7 @@ export class ProductStripeService {
118118
} else if (combo.variant2) {
119119
variantPrices[combo.variant2.id] = stripePrice.id
120120
}
121-
}
121+
}))
122122

123123
// Also create base price for fallback
124124
basePrice = await this.stripe.createPrice({

0 commit comments

Comments
 (0)