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

CORE-17386 - Add flow session timeout scheduled task #4740

Merged
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 @@ -8,6 +8,7 @@ import net.corda.messaging.api.records.Record
import net.corda.orm.JpaEntitiesSet
import net.corda.orm.utils.transaction
import net.corda.orm.utils.use
import net.corda.schema.Schemas
import net.corda.utilities.debug
import net.corda.virtualnode.VirtualNodeInfo
import net.corda.virtualnode.read.VirtualNodeInfoReadService
Expand All @@ -21,9 +22,6 @@ class DeduplicationTableCleanUpProcessor(
) : DurableProcessor<String, ScheduledTaskTrigger> {
companion object {
private val log = LoggerFactory.getLogger(DeduplicationTableCleanUpProcessor::class.java)

// Need to merge with `SchedulerProcessorImpl.DEDUPLICATION_TABLE_CLEAN_UP_TASK` but there isn't currently a good candidate module
private const val DEDUPLICATION_TABLE_CLEAN_UP_TASK = "deduplication-table-clean-up-task"
}

override val keyClass: Class<String>
Expand All @@ -36,7 +34,7 @@ class DeduplicationTableCleanUpProcessor(
events
.forEach {
val taskName = it.key
if (taskName == DEDUPLICATION_TABLE_CLEAN_UP_TASK) {
if (taskName == Schemas.ScheduledTask.SCHEDULED_TASK_NAME_DB_PROCESSOR) {
log.debug { "Cleaning up deduplication table for all vnodes" }
val startTime = System.nanoTime()
virtualNodeInfoReadService.getAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import net.corda.lifecycle.StopEvent
import net.corda.lifecycle.createCoordinator
import net.corda.orm.JpaEntitiesRegistry
import net.corda.processors.scheduler.SchedulerProcessor
import net.corda.schema.Schemas.ScheduledTask.SCHEDULED_TASK_DB_PROCESSOR
import net.corda.schema.Schemas.ScheduledTask
import net.corda.schema.configuration.BootConfig
import org.osgi.service.component.annotations.Activate
import org.osgi.service.component.annotations.Component
Expand Down Expand Up @@ -51,8 +51,6 @@ class SchedulerProcessorImpl @Activate constructor(

companion object {
private val logger = LoggerFactory.getLogger(this::class.java.enclosingClass)

private const val DEDUPLICATION_TABLE_CLEAN_UP_TASK = "deduplication-table-clean-up-task"
}

private val dependentComponents = DependentComponents.of(
Expand All @@ -66,7 +64,11 @@ class SchedulerProcessorImpl @Activate constructor(

// now just hardcoding schedulers here until CORE-16331 is picked up, when we should take this from config
private val schedules = listOf<Schedule>(
Schedule(DEDUPLICATION_TABLE_CLEAN_UP_TASK, 120, SCHEDULED_TASK_DB_PROCESSOR)
Schedule(ScheduledTask.SCHEDULED_TASK_NAME_DB_PROCESSOR,
120, ScheduledTask.SCHEDULED_TASK_TOPIC_DB_PROCESSOR),
Schedule(
ScheduledTask.SCHEDULED_TASK_NAME_SESSION_TIMEOUT,
60, ScheduledTask.SCHEDULED_TASK_TOPIC_FLOW_PROCESSOR),
)
private var schedulers: Schedulers? = null

Expand Down