feat(utils): Introduce promiseAll util (#5543)

This commit is contained in:
Adrien de Peretti
2023-11-08 08:48:48 +01:00
committed by GitHub
parent e4ce2f4e07
commit f90ba02087
99 changed files with 464 additions and 297 deletions
@@ -1,5 +1,6 @@
import { BaseService } from "medusa-interfaces"
import { INCLUDE_PRESENTMENT_PRICES } from "../utils/const"
import { promiseAll } from "@medusajs/utils"
class ShopifyService extends BaseService {
constructor(
@@ -83,11 +84,10 @@ class ShopifyService extends BaseService {
updatedSinceQuery
)
const resolvedProducts = await Promise.all(
const productServiceTx = this.productService_.withTransaction(manager)
const resolvedProducts = await promiseAll(
products.map(async (product) => {
return await this.productService_
.withTransaction(manager)
.create(product)
return await productServiceTx.create(product)
})
)