File tree Expand file tree Collapse file tree
src/main/kotlin/com/github/quiltservertools/ledger/database Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ import kotlin.math.ceil
7373const val MAX_QUERY_RETRIES = 10
7474const val MIN_RETRY_DELAY = 1000L
7575const val MAX_RETRY_DELAY = 300_000L
76+ private const val MAX_EXTRA_DATA_BYTES = 65_535
7677
7778object DatabaseManager {
7879
@@ -456,7 +457,18 @@ object DatabaseManager {
456457 }
457458
458459 private fun Transaction.insertActions (actions : List <ActionType >) {
459- Tables .Actions .batchInsert(actions, shouldReturnGeneratedValues = false ) { action ->
460+ val (safe, oversized) = actions.partition {
461+ it.extraData == null || it.extraData!! .length <= MAX_EXTRA_DATA_BYTES
462+ }
463+ oversized.forEach { action ->
464+ logWarn(
465+ " Skipping action log: extra_data too large (${action.extraData!! .length} chars) " +
466+ " for action ${action.identifier} at " +
467+ " [${action.world} ${action.pos.x} ${action.pos.y} ${action.pos.z} ] " +
468+ " by ${action.sourceProfile?.name ? : action.sourceName} " ,
469+ )
470+ }
471+ Tables .Actions .batchInsert(safe, shouldReturnGeneratedValues = false ) { action ->
460472 this [Tables .Actions .actionIdentifier] = getOrCreateActionId(action.identifier)
461473 this [Tables .Actions .timestamp] = action.timestamp
462474 this [Tables .Actions .x] = action.pos.x
You can’t perform that action at this time.
0 commit comments