Bulk Processing

MAX_BULK_OPERATION_SIZE, batch permission evaluation, transactional vs. error-tolerant mutations, offset-pagination, and chunking.

Input Size Guard

All bulk mutations enforce a maximum input size of 500:

kotlin

The Bulk Mutation Pattern

kotlin
No N+1 at any layer — data loading, permission checking, and the write are all batched.

Prefer Bulk Operations End-to-End

Push the list down through service and repository layers rather than looping at the controller level.

Repository: bulk SQL

kotlin

Service: bulk SQL + per-item side effects

kotlin
Avoid looping at the controller with single-item service calls — that produces N SQL statements instead of 1.

Transactional vs. Error-Tolerant

Transactional (all-or-nothing)

If any item fails, everything rolls back. Use when partial completion would be inconsistent.

Examples: deleteAll, setPublicAll, setWorkflowStateAll, setReadyAll

Error-tolerant (best-effort)

Per-item try/catch. Failed items are logged and skipped. Returns success count.

kotlin

Examples: setMetadataReadyAll, processMediaAll, beginTransitions

Locked Entity Handling

Filter locked entities before the permission check. SA users skip the filter:

kotlin

Background Job Batch Processing

Background jobs use offset-pagination loops:

kotlin