Skip to content

Commit

Permalink
Fix detekt issues and revert internal naming
Browse files Browse the repository at this point in the history
  • Loading branch information
bog-walk committed Oct 7, 2024
1 parent b5331f1 commit 4e09b95
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ abstract class AbstractQuery<T : AbstractQuery<T>>(
companion object {
private fun trackResultSet(transaction: Transaction) {
val threshold = transaction.db.config.logTooMuchResultSetsThreshold
if (threshold > 0 && threshold < transaction.openResultsCount) {
if (threshold > 0 && threshold < transaction.openResultSetsCount) {
val message =
"Current opened result sets size ${transaction.openResultsCount} exceeds $threshold threshold for transaction ${transaction.id} "
"Current opened result sets size ${transaction.openResultSetsCount} exceeds $threshold threshold for transaction ${transaction.id} "
val stackTrace = Exception(message).stackTraceToString()
exposedLogger.error(stackTrace)
}
transaction.openResultsCount++
transaction.openResultSetsCount++
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ open class Transaction(
internal var blockStatementExecution: Boolean = false

internal val executedStatements: MutableList<PreparedStatementApi> = arrayListOf()
internal var openResultsCount: Int = 0
internal var openResultSetsCount: Int = 0

internal val interceptors = arrayListOf<StatementInterceptor>()

Expand Down Expand Up @@ -361,7 +361,7 @@ open class Transaction(
executedStatements.forEach {
it.closeIfPossible()
}
openResultsCount = 0
openResultSetsCount = 0
executedStatements.clear()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal abstract class StatementIterator<RA : ResultApi, T, RR>(
field = value
if (!field) {
result.releaseResult()
TransactionManager.current().openResultsCount--
TransactionManager.current().openResultSetsCount--
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import org.reactivestreams.Publisher
/**
* Class representing a wrapped R2DBC database [connection].
*/
@Suppress("UnusedPrivateMember", "SpreadOperator")
// should all ExposedConnection interface methods suspend?
@Suppress("UnusedPrivateMember", "SpreadOperator")
class R2dbcConnectionImpl(
vendorDialect: String,
override val connection: Publisher<out Connection>,
Expand All @@ -44,6 +44,7 @@ class R2dbcConnectionImpl(
get() = try { metadataProvider.getSchema() } catch (_: Exception) { "" }
set(value) { try { metadataProvider.setSchema(value) } catch (_: Exception) {} }

// should all these methods SUSPEND instead of relying on withConnection()?
override fun commit() {
withConnection { it.commitTransaction().awaitFirstOrNull() }
}
Expand Down

0 comments on commit 4e09b95

Please sign in to comment.