Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check db for triggering jobs less frequently #551

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
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 @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
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_
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
1 change: 1 addition & 0 deletions newm-server/src/main/resources/quartz.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading