Skip to content

MAX_EVENTS_PER_BATCH

const MAX_EVENTS_PER_BATCH: 1000 = 1000

Defined in: packages/contracts/src/events.ts:32

The batch ingestion endpoint. Deliberate constants, not tuning: the client flush loop clamps its batching to them and the server enforces them independently of any client’s configuration.

MAX_EVENTS_PER_BATCH (1000) — one flush batch. Large enough that a device draining an offline backlog makes real progress per round trip, small enough that one batch stays a modest request and one queue transaction.

MAX_EVENT_PAYLOAD_BYTES (64 KiB) — the serialized payload of ONE event. Events are facts, not documents; a payload approaching this is a modelling smell. Enforced at appendEvent (so the library caller fails at the call site) AND at ingest, where a single oversized payload is a per-event rejected verdict rather than a batch fault.

MAX_EVENT_REQUEST_BYTES (4 MiB) — the whole request body, the backstop for the two above (1000 events × 64 KiB would exceed it, deliberately: the body cap binds first). A violation is a batch-level 413, reachable only under deployment skew or from a non-library caller.