function reserveSession
reserveSession(sessionId: string): Promise<ReserveSessionResult>

Reserve a payment session for processing (first phase of two-phase lock) Inserts with NULL attendee_id to claim the session. Returns { reserved: true } if we claimed it, or { reserved: false, existing } if already claimed.

Handles abandoned reservations: if an existing reservation has NULL attendee_id and is older than STALE_RESERVATION_MS, we assume the process crashed and delete the stale record to allow retry.

Parameters

sessionId: string

Return Type

Usage

import { reserveSession } from "docs/database.ts";