Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import kotlin.math.ceil
const val MAX_QUERY_RETRIES = 10
const val MIN_RETRY_DELAY = 1000L
const val MAX_RETRY_DELAY = 300_000L
private const val MAX_EXTRA_DATA_BYTES = 65_535

object DatabaseManager {

Expand Down Expand Up @@ -456,7 +457,18 @@ object DatabaseManager {
}

private fun Transaction.insertActions(actions: List<ActionType>) {
Tables.Actions.batchInsert(actions, shouldReturnGeneratedValues = false) { action ->
val (safe, oversized) = actions.partition {
it.extraData == null || it.extraData!!.length <= MAX_EXTRA_DATA_BYTES
}
oversized.forEach { action ->
logWarn(
"Skipping action log: extra_data too large (${action.extraData!!.length} chars) " +
"for action ${action.identifier} at " +
"[${action.world} ${action.pos.x} ${action.pos.y} ${action.pos.z}] " +
"by ${action.sourceProfile?.name ?: action.sourceName}",
)
}
Tables.Actions.batchInsert(safe, shouldReturnGeneratedValues = false) { action ->
this[Tables.Actions.actionIdentifier] = getOrCreateActionId(action.identifier)
this[Tables.Actions.timestamp] = action.timestamp
this[Tables.Actions.x] = action.pos.x
Expand Down