OptionalidsOptionalbatchMax 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.
OptionaldelayCoalescing 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.
OptionalmaxPer-id failure cap (default DEFAULT_DRAIN_MAX_ATTEMPTS): after this many failed passes containing the id, it is dropped with a log.
OptionalhandlerExtra 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.
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".