@unchainedshop/platform 4.8.15 → 4.8.17

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,13 +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 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
- }
22
+ await unchainedAPI.modules.worker.addWorkIfNotExists({
23
+ type: 'INVALIDATE_CARTS',
24
+ input: workQueueOptions.providerInvalidationMaxAgeDays !== undefined
25
+ ? { maxAgeDays: workQueueOptions.providerInvalidationMaxAgeDays }
26
+ : {},
27
+ retries: 0,
28
+ }, (work) => !work.autoscheduled);
29
29
  }
30
30
  if (workQueueOptions.assignCartForUsers ?? Boolean(UNCHAINED_ASSIGN_CART_FOR_USERS)) {
31
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.15",
4
+ "version": "4.8.17",
5
5
  "main": "lib/platform-index.js",
6
6
  "types": "lib/platform-index.d.ts",
7
7
  "type": "module",