diff --git a/newm-server/src/main/kotlin/io/newm/server/database/DatabaseKoinModule.kt b/newm-server/src/main/kotlin/io/newm/server/database/DatabaseKoinModule.kt index cf97c5f1..d57bdce5 100644 --- a/newm-server/src/main/kotlin/io/newm/server/database/DatabaseKoinModule.kt +++ b/newm-server/src/main/kotlin/io/newm/server/database/DatabaseKoinModule.kt @@ -20,12 +20,12 @@ val databaseKoinModule = } isAutoCommit = false transactionIsolation = "TRANSACTION_REPEATABLE_READ" - connectionTimeout = 40_000L + connectionTimeout = 30_000L maximumPoolSize = 30 minimumIdle = 5 - maxLifetime = 600_000L // 10 minutes - validationTimeout = 12_000L - idleTimeout = 12_000L + maxLifetime = 300_000L // 5 minutes + validationTimeout = 10_000L + idleTimeout = 60_000L leakDetectionThreshold = 60_000L } } diff --git a/newm-server/src/main/kotlin/io/newm/server/features/earnings/daemon/MonitorClaimOrderJob.kt b/newm-server/src/main/kotlin/io/newm/server/features/earnings/daemon/MonitorClaimOrderJob.kt index fe8959c1..8c34ea76 100644 --- a/newm-server/src/main/kotlin/io/newm/server/features/earnings/daemon/MonitorClaimOrderJob.kt +++ b/newm-server/src/main/kotlin/io/newm/server/features/earnings/daemon/MonitorClaimOrderJob.kt @@ -27,7 +27,6 @@ import io.newm.shared.koin.inject import io.newm.shared.ktx.toUUID import io.newm.txbuilder.ktx.extractFields import java.math.BigInteger -import java.sql.Connection.TRANSACTION_SERIALIZABLE import java.time.LocalDateTime import java.time.ZoneOffset import kotlin.time.Duration.Companion.minutes @@ -214,7 +213,7 @@ class MonitorClaimOrderJob : Job { val submitTransactionResponse = cardanoRepository.submitTransaction(transactionBuilderResponse.transactionCbor) if (submitTransactionResponse.result == "MsgAcceptTx") { - newSuspendedTransaction(transactionIsolation = TRANSACTION_SERIALIZABLE) { + newSuspendedTransaction { earningsRepository.claimed( claimOrderId = claimOrder.id!!, earningsIds = claimOrder.earningsIds diff --git a/newm-server/src/main/kotlin/io/newm/server/features/earnings/repo/EarningsRepositoryImpl.kt b/newm-server/src/main/kotlin/io/newm/server/features/earnings/repo/EarningsRepositoryImpl.kt index df38d23c..583b018f 100644 --- a/newm-server/src/main/kotlin/io/newm/server/features/earnings/repo/EarningsRepositoryImpl.kt +++ b/newm-server/src/main/kotlin/io/newm/server/features/earnings/repo/EarningsRepositoryImpl.kt @@ -27,7 +27,6 @@ import io.newm.server.typealiases.SongId import io.newm.shared.koin.inject import io.newm.shared.ktx.toDate import io.newm.shared.ktx.toHexString -import java.sql.Connection.TRANSACTION_SERIALIZABLE import java.time.Instant import java.time.LocalDateTime import java.util.UUID @@ -210,7 +209,7 @@ class EarningsRepositoryImpl( private suspend fun createClaimOrderInternal(claimOrderRequest: ClaimOrderRequest): ClaimOrder? { val claimOrder = - newSuspendedTransaction(transactionIsolation = TRANSACTION_SERIALIZABLE) { + newSuspendedTransaction { val stakeAddress = claimOrderRequest.walletAddress.extractStakeAddress(cardanoRepository.isMainnet()) // check for existing open claim record first getActiveClaimOrderByStakeAddress(stakeAddress) ?: run { diff --git a/newm-server/src/main/resources/monitor_orders_quartz.properties b/newm-server/src/main/resources/monitor_orders_quartz.properties index e1b96511..3023c9e3 100644 --- a/newm-server/src/main/resources/monitor_orders_quartz.properties +++ b/newm-server/src/main/resources/monitor_orders_quartz.properties @@ -1,6 +1,6 @@ org.quartz.scheduler.instanceId = AUTO org.quartz.scheduler.instanceName = ClaimOrdersScheduler -org.quartz.threadPool.threadCount = 100 +org.quartz.threadPool.threadCount = 50 org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate org.quartz.jobStore.tablePrefix = QRTZ_ @@ -8,3 +8,4 @@ org.quartz.jobStore.dataSource = newmServerDatasource org.quartz.jobStore.isClustered = true org.quartz.jobStore.clusterCheckinInterval = 30000 org.quartz.dataSource.newmServerDatasource.connectionProvider.class = io.newm.server.features.scheduler.SchedulerPoolingConnectionProvider +org.quartz.scheduler.batchTriggerAcquisitionFireAheadTimeWindow = 10000 \ No newline at end of file diff --git a/newm-server/src/main/resources/quartz.properties b/newm-server/src/main/resources/quartz.properties index 21e9262c..9b10d37c 100644 --- a/newm-server/src/main/resources/quartz.properties +++ b/newm-server/src/main/resources/quartz.properties @@ -8,3 +8,4 @@ org.quartz.jobStore.dataSource = newmServerDatasource org.quartz.jobStore.isClustered = true org.quartz.jobStore.clusterCheckinInterval = 30000 org.quartz.dataSource.newmServerDatasource.connectionProvider.class = io.newm.server.features.scheduler.SchedulerPoolingConnectionProvider +org.quartz.scheduler.batchTriggerAcquisitionFireAheadTimeWindow = 10000