chunked

fun SessionHistory.chunked(actionsPerChunk: Int = 250, eventsPerChunk: Int = 1000, networkPerChunk: Int = 50, networkBytesPerChunk: Int = WireBudget.MAX_PAYLOAD_BYTES): List<SessionHistory>(source)

Splits a history into pieces small enough to send as individual messages.

Actions and logic events are cut by count, which tracks their size closely enough. Network exchanges are cut by whichever comes first, count or WireBudget.MAX_PAYLOAD_BYTES of estimated payload, because a single exchange carries full request and response bodies and can be larger on its own than a thousand logic events.

Parameters

actionsPerChunk

Maximum actions in one chunk

eventsPerChunk

Maximum logic events of each kind in one chunk

networkPerChunk

Upper bound on exchanges per chunk, before the byte budget applies

networkBytesPerChunk

Estimated payload budget for the exchanges in one chunk