Skip to content

Commit fe81acd

Browse files
committed
Remove forUpdate parameter from balanceDecimal0 in TransactionRepositoryImpl and update usages
1 parent 24e8df9 commit fe81acd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

surf-transaction-core/src/main/kotlin/dev/slne/surf/transaction/core/db/transaction/TransactionRepositoryImpl.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class TransactionRepositoryImpl : TransactionRepository {
4747
}
4848

4949
if (receiverID != null && !transaction.ignoreMinimumAmount) {
50-
val balanceAfterTransaction = balanceDecimal0(receiverID, currencyID, forUpdate = true)
50+
val balanceAfterTransaction = balanceDecimal0(receiverID, currencyID)
5151
if (balanceAfterTransaction < transaction.currency.minimumAmount) {
5252
return TransactionResult.ReceiverInsufficientFunds
5353
}
@@ -68,8 +68,7 @@ class TransactionRepositoryImpl : TransactionRepository {
6868

6969
suspend fun balanceDecimal0(
7070
accountID: Long,
71-
currencyID: Long,
72-
forUpdate: Boolean = false
71+
currencyID: Long
7372
): BigDecimal {
7473
return TransactionTable
7574
.innerJoin(CurrencyTable)
@@ -78,7 +77,6 @@ class TransactionRepositoryImpl : TransactionRepository {
7877
(CurrencyTable.id eq currencyID) and
7978
(TransactionTable.receiver eq accountID)
8079
}
81-
.let { if (forUpdate) it.forUpdate() else it }
8280
.map { it[TransactionTable.amount.sum()] }
8381
.singleOrNull() ?: BigDecimal.ZERO
8482
}

0 commit comments

Comments
 (0)