@unchainedshop/plugins 4.8.16 → 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.
- package/lib/worker/gc-guests.js +2 -7
- package/package.json +1 -1
package/lib/worker/gc-guests.js
CHANGED
|
@@ -15,12 +15,7 @@ export const GCGuestsWorker = {
|
|
|
15
15
|
try {
|
|
16
16
|
const maxAgeInDays = guestUserMaxAgeInDays ?? userSettings.guestUserMaxAgeInDays;
|
|
17
17
|
const before = new Date(Date.now() - maxAgeInDays * ONE_DAY_IN_MILLISECONDS);
|
|
18
|
-
const
|
|
19
|
-
const recentCarts = candidateIds.length
|
|
20
|
-
? await modules.orders.findCarts({ userIds: candidateIds }, { projection: { userId: 1, updated: 1 } })
|
|
21
|
-
: [];
|
|
22
|
-
const userIdsWithRecentCart = new Set(recentCarts.filter((cart) => cart.updated && cart.updated >= before).map((c) => c.userId));
|
|
23
|
-
const userIdsToDelete = candidateIds.filter((id) => !userIdsWithRecentCart.has(id));
|
|
18
|
+
const userIdsToDelete = await modules.users.findGuestUserIds({ before });
|
|
24
19
|
let deletedGuestCount = 0;
|
|
25
20
|
await Array.fromAsync(userIdsToDelete, async (userId) => {
|
|
26
21
|
try {
|
|
@@ -34,7 +29,7 @@ export const GCGuestsWorker = {
|
|
|
34
29
|
return {
|
|
35
30
|
success: true,
|
|
36
31
|
result: {
|
|
37
|
-
scannedGuestCount:
|
|
32
|
+
scannedGuestCount: userIdsToDelete.length,
|
|
38
33
|
deletedGuestCount,
|
|
39
34
|
},
|
|
40
35
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/plugins",
|
|
3
3
|
"description": "Official plugin collection for the Unchained Engine with payment, delivery, and pricing adapters",
|
|
4
|
-
"version": "4.8.
|
|
4
|
+
"version": "4.8.17",
|
|
5
5
|
"main": "lib/plugins-index.js",
|
|
6
6
|
"types": "lib/plugins-index.d.ts",
|
|
7
7
|
"exports": {
|