diff --git a/service/src/main/kotlin/io/provenance/explorer/domain/entities/Transactions.kt b/service/src/main/kotlin/io/provenance/explorer/domain/entities/Transactions.kt index b3bf4986..86a2aff4 100644 --- a/service/src/main/kotlin/io/provenance/explorer/domain/entities/Transactions.kt +++ b/service/src/main/kotlin/io/provenance/explorer/domain/entities/Transactions.kt @@ -395,6 +395,8 @@ class TxMessageRecord(id: EntityID) : IntEntity(id) { fun findByQueryForResults(txQueryParams: TxQueryParams) = transaction { val query = findByQueryParams(txQueryParams, listOf(distId) + tableColSet) + .alias("subQuery") //create a subquery to delay sorting until after the distinct + .selectAll() .orderBy(Pair(TxMessageTable.blockHeight, SortOrder.DESC)) .limit(txQueryParams.count, txQueryParams.offset.toLong()) TxMessageRecord.wrapRows(query).toSet() @@ -451,6 +453,7 @@ class TxMessageRecord(id: EntityID) : IntEntity(id) { query } + fun buildInsert(txInfo: TxData, message: Any, msgIdx: Int) = transaction { listOf( 0, diff --git a/service/src/main/kotlin/io/provenance/explorer/service/async/ScheduledTaskService.kt b/service/src/main/kotlin/io/provenance/explorer/service/async/ScheduledTaskService.kt index 0ed4e062..460da9fa 100644 --- a/service/src/main/kotlin/io/provenance/explorer/service/async/ScheduledTaskService.kt +++ b/service/src/main/kotlin/io/provenance/explorer/service/async/ScheduledTaskService.kt @@ -94,7 +94,7 @@ class ScheduledTaskService( }.start() } - @Scheduled(initialDelay = 0L, fixedDelay = 300000L) // Every 5 minutes + @Scheduled(initialDelay = 0L, fixedDelay = 5000L) fun updateLatestBlockHeightJob() { val index = getBlockIndex() val startHeight = blockService.getLatestBlockHeight() @@ -211,7 +211,7 @@ class ScheduledTaskService( @Scheduled(initialDelay = 0L, fixedDelay = 5000L) fun updateSpotlight() = explorerService.createSpotlight() - @Scheduled(initialDelay = 0L, fixedDelay = 300000L) // Every 5 minutes + @Scheduled(initialDelay = 0L, fixedDelay = 5000L) fun retryBlockTxs() { logger.info("Retrying block/tx records") BlockTxRetryRecord.getRecordsToRetry().map { height -> @@ -263,7 +263,7 @@ class ScheduledTaskService( tokenService.updateAndSaveTokenHistoricalData(startDate, today) } - @Scheduled(initialDelay = 0L, fixedDelay = 600000L) // Every 5 minutes + @Scheduled(initialDelay = 0L, fixedDelay = 5000L) fun updateTokenLatest() { val today = DateTime.now().withZone(DateTimeZone.UTC) val startDate = today.minusDays(1) @@ -349,7 +349,7 @@ class ScheduledTaskService( } } - @Scheduled(initialDelay = 5000L, fixedDelay = 300000L) // Every 5 minutes + @Scheduled(initialDelay = 5000L, fixedDelay = 5000L) fun startAccountProcess() { processAccountRecords() }