Creating Plot Twists
    Preparing search index...

    Type Alias DrainOptions

    type DrainOptions = {
        ids?: string[];
        batchSize?: number;
        delayMs?: number;
        maxAttempts?: number;
        handlerArgs?: Serializable[];
    }
    Index

    Properties

    ids?: string[]

    External item ids to record as dirty. Omit (or pass []) for signal-only drains where the handler derives its own work — e.g. from a provider cursor or a time window — and just needs "run soon, once".

    batchSize?: number

    Max ids passed to the handler per pass (default DEFAULT_DRAIN_BATCH_SIZE). Size this so one pass stays well inside the worker memory and request budget.

    delayMs?: number

    Coalescing delay (default DEFAULT_DRAIN_DELAY_MS): the drain runs at most this long after the first scheduleDrain call of a burst. Later calls never push the pending pass back.

    maxAttempts?: number

    Per-id failure cap (default DEFAULT_DRAIN_MAX_ATTEMPTS): after this many failed passes containing the id, it is dropped with a log.

    handlerArgs?: Serializable[]

    Extra arguments appended after the ids slice when the handler is invoked — handler(ids, ...handlerArgs). Use for per-scope drains (e.g. a per-channel key whose handler needs the channel id). Must be serializable; frozen at the first call of a coalesced burst, so keep them constant for a given key.