Skip to main content

GC Guests Worker

Deletes stale guest users. A guest is considered stale when both its created date and its last activity signal (lastLogin.timestamp, bumped on login and by the heartbeat mutation) are older than the cutoff. Deleting a guest cascade-deletes its open carts.

Included in Base Preset

Registered automatically by registerBasePlugins() / registerAllPlugins().

Registration​

import { pluginRegistry } from '@unchainedshop/core';
import { GCGuestsPlugin } from '@unchainedshop/plugins/worker/gc-guests';

pluginRegistry.register(GCGuestsPlugin);

Auto-Scheduling​

Runs automatically every day at 02:30 (cron 30 2 * * *, retries 0), configured on registration.

Usage​

Trigger a run manually:

mutation CollectGuests {
addWork(
type: GC_GUESTS
input: { guestUserMaxAgeInDays: 14 }
) {
_id
status
}
}

Input Parameters​

ParameterTypeDefaultDescription
guestUserMaxAgeInDaysNumberusers module setting guestUserMaxAgeInDays (default 30, overridable via UNCHAINED_GUEST_USER_EXPIRY_DAYS)Guests without activity for this many days are deleted

Result​

{
"scannedGuestCount": 0,
"deletedGuestCount": 0
}

Adapter Details​

PropertyValue
Keyshop.unchained.worker-plugin.gc-guests
TypeGC_GUESTS
Auto-ScheduleDaily at 02:30
Retries0
Sourceworker/gc-guests