Kaizen
Browse modulesBookingsbookings/serverClasses

Class: HoldSweeper

Defined in: server/bookings/hold-sweeper.ts:47

Consumer-scheduled hold sweeper (§6.3/§6.10/§11).

sweep() finds every held booking whose hold_expires_at <= now (hitting the [status, holdExpiresAt] composite index), group-expands each hit so a group hold always expires as a unit (§6.10), and expires each member via the service's expireHold() — which runs a real version-CAS updateIfVersion() under the hood. A concurrent confirm that wins the CAS first leaves the sweeper's attempt throwing StaleBookingError; those are caught and counted as skipped (§14).

This is intentionally NOT a baked-in cron. Wire it to your consumer's Trigger.dev / BullMQ / pg-cron job and call sweep() on each tick.

Constructors

Constructor

new HoldSweeper(deps: HoldSweeperDeps): HoldSweeper;

Defined in: server/bookings/hold-sweeper.ts:48

Parameters

ParameterType
depsHoldSweeperDeps

Returns

HoldSweeper

Methods

sweep()

sweep(): Promise<SweepResult>;

Defined in: server/bookings/hold-sweeper.ts:50

Returns

Promise<SweepResult>

On this page