@unchainedshop/platform 4.8.14 → 4.8.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,10 +19,13 @@ export async function setupWorkqueue({ unchainedAPI, migrationRepository, ...wor
19
19
  handler.start();
20
20
  });
21
21
  if (workQueueOptions.invalidateProviders ?? !UNCHAINED_DISABLE_PROVIDER_INVALIDATION) {
22
- const orders = await unchainedAPI.modules.orders.findCartsToInvalidate(workQueueOptions.providerInvalidationMaxAgeDays);
23
- await Promise.allSettled(orders.map(async (order) => {
24
- await unchainedAPI.services.orders.updateCalculation(order._id);
25
- }));
22
+ const orderIds = await unchainedAPI.modules.orders.findCartIdsToInvalidate(workQueueOptions.providerInvalidationMaxAgeDays);
23
+ const BATCH = 50;
24
+ for (let i = 0; i < orderIds.length; i += BATCH) {
25
+ await Promise.allSettled(orderIds
26
+ .slice(i, i + BATCH)
27
+ .map((orderId) => unchainedAPI.services.orders.updateCalculation(orderId)));
28
+ }
26
29
  }
27
30
  if (workQueueOptions.assignCartForUsers ?? Boolean(UNCHAINED_ASSIGN_CART_FOR_USERS)) {
28
31
  const users = await unchainedAPI.modules.users.findUsers({});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/platform",
3
3
  "description": "Complete e-commerce platform bundle for the Unchained Engine",
4
- "version": "4.8.14",
4
+ "version": "4.8.15",
5
5
  "main": "lib/platform-index.js",
6
6
  "types": "lib/platform-index.d.ts",
7
7
  "type": "module",