Hakon Grotte
10/23/2023, 7:33 AMsuspendedTransactionAsync
. I feel like this is a bad idea, but I'm not completely sure why. Given the definitions:
data class CustomerTransactionId (
val customerId: UUID,
val transactionId: UUID
)
val customerTransactionIds: List<CustomerTransactionId>
Is the following code a bad idea? Why?
customerTransactionIds.map { customerTransactionId ->
suspendedTransactionAsync(Dispatchers.IO) {
CustomerTransactionTable.update({ CustomerTransactionTable.customerId eq customerTransactionId.customerId
}) { updateStmt ->
updateStmt[transactionId] = customerTransactionId.transactionId
}
}
}.awaitAll()
Each update statement is independent of the others.